DefinitelyTyped/types/nanoevents/nanoevents-tests.ts
2018-08-12 04:20:29 +09:00

9 lines
295 B
TypeScript

import NanoEvents = require('nanoevents');
import unbindAll = require('nanoevents/unbind-all');
const emitter = new NanoEvents<{foo: {foo: string}, bar: {bar: string}}>();
const unbind = emitter.on('foo', action => action.foo);
emitter.emit('bar', {bar: 'test'});
unbind();
unbindAll(emitter);