[Adonis 4.1] Event not emiting #1417
Answered
by
thetutlage
wemersonrv
asked this question in
Help
-
Hi folks, i'm facing an issue with events... first create a listener with 'use strict'
const Message = (exports = module.exports = {})
Message.incoming = async () => {
console.log('A new message has arrived' )
} After that, i registered the event in const Event = use('Event')
Event.on('message::incoming', 'Message.incoming') But when i try to emit the event, nothing happens... const Event = use('Event')
Event.emit('message::incoming') Did i miss someting? |
Beta Was this translation helpful? Give feedback.
Answered by
thetutlage
Aug 8, 2020
Replies: 1 comment 3 replies
-
Should work, I don't see anything wrong with the code. What happens when you replace the event handler with an inline function? Event.on('message::incoming', () => {
console.log('A new message has arrived' )
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
wemersonrv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should work, I don't see anything wrong with the code. What happens when you replace the event handler with an inline function?