Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3877264
commit a0a4c6e
Showing
24 changed files
with
472 additions
and
614 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ node_modules | |
yarn.lock | ||
.nyc_output | ||
coverage | ||
/legacy.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {expectType, expectError} from 'tsd'; | ||
import Emittery = require('.'); | ||
|
||
// emit | ||
{ | ||
const ee = new Emittery(); | ||
ee.emit('anEvent'); | ||
ee.emit('anEvent', 'some data'); | ||
} | ||
|
||
// on | ||
{ | ||
const ee = new Emittery(); | ||
ee.on('anEvent', () => undefined); | ||
ee.on('anEvent', () => Promise.resolve()); | ||
ee.on('anEvent', data => undefined); | ||
ee.on('anEvent', data => Promise.resolve()); | ||
const off = ee.on('anEvent', () => undefined); | ||
off(); | ||
} | ||
|
||
// off | ||
{ | ||
const ee = new Emittery(); | ||
ee.off('anEvent', () => undefined); | ||
ee.off('anEvent', () => Promise.resolve()); | ||
ee.off('anEvent', data => undefined); | ||
ee.off('anEvent', data => Promise.resolve()); | ||
} | ||
|
||
{ | ||
const ee = new Emittery(); | ||
expectError(ee.emit('anEvent', 'some data', 'and more')); | ||
} | ||
|
||
{ | ||
const ee = new Emittery(); | ||
expectError(ee.on('anEvent', (data: any, more: any) => undefined)); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.