emittery
emittery copied to clipboard
Simple and modern async event emitter
Fixes #97. I implemented @thetutlage's solution [here](https://github.com/sindresorhus/emittery/issues/97#issuecomment-1129591450).
The https://github.com/sindresorhus/emittery/pull/96 introduces a regression when emittery is used as a sub-class. Lemme share a code sample. ```ts const Emittery = require("emittery"); class MyEmitter extends Emittery { async emit(eventName, data)...
Usage case: 1) On new requiest an event `request` fired. This allows to capture request state and deserialize access tokens, session from cookies, etc. 2) On just before the body...
https://github.com/sindresorhus/emittery/blob/c4c11e44c8a02f20d0d1cb0257aa0921c9d7d4d2/index.test-d.ts#L261-L280
My emitter: ```ts import Emittery from 'emittery' import { logger } from './' const eventBus: Emittery = new Emittery({ debug: { name: 'eventBus', enabled: process.env.ENVIRONMENT !== 'production', logger: (type, debugName,...
  My usage, I'm using `Ref` because we are using Vue in this project. ```typescript const bus = ref(new Bus()) bus.value.emitter.on("newDataRequest", loadNewDataRequests) ``` `loadNewDataRequests` is of signature `() =>...
Hi, thanks for your great work. Does Emittery support wildcard emit?
See the initial attempt and feedback in https://github.com/sindresorhus/emittery/pull/19.
When trying to subscribe to listener's added / removed on the `Emittery.Typed` class, TypeScript (v. 3.9.5) complains that: ``` src/utils.ts:68:13 - error TS2769: No overload matches this call. Overload 1...
If I have the following snippet ```ts emitter.on(Emittery.listenerAdded, () => { console.log('Count: ', emitter.listenerCount('helloEvent')) }) emitter.on('helloEvent', () => {}) emitter.on('helloEvent', () => {}) ``` Then I get printed: ``` Count:...