We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emit('eventName')
emit(undefined)
My emitter:
import Emittery from 'emittery' import { logger } from './' const eventBus: Emittery = new Emittery({ debug: { name: 'eventBus', enabled: process.env.ENVIRONMENT !== 'production', logger: (type, debugName, eventName, eventData) => { logger.debug(`${debugName}: ${type} ${JSON.stringify(eventName)}`, eventData) } } }) export default eventBus
My handler
eventBus.on('closeMailer', () => { logger.debug('Closing mailer') mailer.close() })
My event
eventBus.emit('closeMailer')
The result:
[1630369974586] DEBUG (20026 on selfagency-m1mini.local): eventBus: subscribe "closeMailer" [1630369974587] DEBUG (20026 on selfagency-m1mini.local): eventBus: emit undefined
When I try to use a Symbol instead of a string, as specified in the README, TypeScript says it's an invalid type for the parameter.
Symbol
string
README
The text was updated successfully, but these errors were encountered:
Never mind I just saw the TypeScript instructions
Sorry, something went wrong.
Wait no, even after adding the correct typings...
type Events = { closeMailer: undefined } const eventBus: Emittery<Events> = new Emittery<Events>({ debug: { name: 'eventBus', enabled: process.env.ENVIRONMENT !== 'production', logger: (type, debugName, eventName, eventData) => { logger.debug(`${debugName}: ${type} ${JSON.stringify(eventName)}`, eventData) } } })
I get:
[1630376409736] DEBUG (23571 on selfagency-m1mini.local): eventBus: subscribe "closeMailer" [1630376409737] DEBUG (23571 on selfagency-m1mini.local): eventBus: emit undefined
No branches or pull requests
My emitter:
My handler
My event
The result:
When I try to use a
Symbol
instead of astring
, as specified in theREADME
, TypeScript says it's an invalid type for the parameter.The text was updated successfully, but these errors were encountered: