hey, i dont understand the event.emit command.
can anyone give me a working example?
because my exmaple gives me only this output :
2020-02-02T14:49:42+01:00 [ test event:20:10] [{}]
2020-02-02T14:49:42+01:00 [ test event:16:10] Got message "ad" from Montiary
can anyone give me a working example?
Code:
const backend = require('backend');
const engine = require('engine');
const event = require('event');
event.on('chat', function(ev) {
event.emit("test",new Object( [ "test" ] ));
engine.log('Got message "'+ev.text +'" from '+ ev.client.name());
});
event.on('test', function(ev) {
engine.log(ev);
});
because my exmaple gives me only this output :
2020-02-02T14:49:42+01:00 [ test event:20:10] [{}]
2020-02-02T14:49:42+01:00 [ test event:16:10] Got message "ad" from Montiary