Replies: 1 comment
|
This is a docs inconsistency, and it lines up exactly with the working/non-working cases you found. The emitter guide's "listen for class-based events" example registers the listener wrapped in an array: emitter.on(events.UserRegistered, [listeners.SendVerificationEmail])but the emitter.on(events.UserRegistered, listeners.SendVerificationEmail)
emitter.off(events.UserRegistered, listeners.SendVerificationEmail)Your code followed the second (unwrapped) shape, emitter.on(events.OtpRequested, [listeners.SendOtpSms])Your two workarounds (constructing the instance and passing a bound Worth filing the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm a little confused by the documentation; it mentions that you can pass in the listener class from the barrel file into the emitter.
However, using this approach does not trigger the listener at all
All reactions