Skip to content

Commit

Permalink
Fixed useEvent hook
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Oct 19, 2023
1 parent d7b4b09 commit 1abc5a7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ useSceneUpdate(
#### Subscribe to event
```ts
useEvent(
emitter: Phaser.Scene | Phaser.GameObject,
emitter: Phaser.Events.EventEmitter,
event: string,
callback: () => void,
depends: any[]
Expand Down
5 changes: 2 additions & 3 deletions dist/hooks/use-event.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="node" />
import EventEmitter from 'events';
import type Phaser from 'phaser';
/**
* Subscribe to event.
*
Expand All @@ -8,4 +7,4 @@ import EventEmitter from 'events';
* @param callback - Event callback
* @param depends - Callback dependencies
*/
export declare function useEvent(emitter: EventEmitter, event: string, callback: () => void, depends: any[]): void;
export declare function useEvent(emitter: Phaser.Events.EventEmitter, event: string, callback: (...args: any[]) => void, depends: any[]): void;
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "phaser-react-ui",
"description": "React interface render for Phaser engine",
"version": "1.13.0",
"version": "1.13.1",
"keywords": [
"phaser",
"interface",
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/use-event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import EventEmitter from 'events';
import type Phaser from 'phaser';
import { useEffect } from 'react';

/**
Expand All @@ -10,9 +10,9 @@ import { useEffect } from 'react';
* @param depends - Callback dependencies
*/
export function useEvent(
emitter: EventEmitter,
emitter: Phaser.Events.EventEmitter,
event: string,
callback: () => void,
callback: (...args: any[]) => void,
depends: any[],
) {
useEffect(() => {
Expand Down

0 comments on commit 1abc5a7

Please sign in to comment.