Skip to content

Commit da52e4e

Browse files
committed
docs: added missing type argument
1 parent 9c9de98 commit da52e4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/helpers/event-emitter.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The `on` method sets up the listener for an event. It receives two arguments, th
1616
import { EventEmitter } from '@upfrontjs/framework';
1717
import type { MyEvents } from '../types';
1818

19-
const emitter = EventEmitter.getInstance<>();
19+
const emitter = EventEmitter.getInstance<MyEvents>();
2020
emitter.on('myEvent', num => num);
2121
emitter.emit('myEvent', 2);
2222
```
@@ -29,7 +29,7 @@ The `once` method works the same way as the [on](#on) method except once the cal
2929
import { EventEmitter } from '@upfrontjs/framework';
3030
import type { MyEvents } from '../types';
3131

32-
const emitter = EventEmitter.getInstance<>();
32+
const emitter = EventEmitter.getInstance<MyEvents>();
3333
emitter.once('myEvent', num => console.log(num));
3434
emitter.emit('myEvent', 1); // 1 logged out to the console
3535
emitter.emit('myEvent', 1); // nothing happens
@@ -42,7 +42,7 @@ The `prependListener` method works the same way as the [on](#on) method except t
4242
import { EventEmitter } from '@upfrontjs/framework';
4343
import type { MyEvents } from '../types';
4444

45-
const emitter = EventEmitter.getInstance<>();
45+
const emitter = EventEmitter.getInstance<MyEvents>();
4646
emitter.on('myEvent', num => console.log(num));
4747
emitter.prependListener('myEvent', num => console.log('first log: ', num));
4848
emitter.emit('myEvent', 1); // logged out 'first log: 1', then '1'

0 commit comments

Comments
 (0)