ml-event
v0.0.3
Published
The event package for Microlattice.js
Downloads
3
Readme
ml-event
Usage
- Copy this content in your Microlattice.js project.
global.eventStatus
is the fixed name, don't change to other name.
API
/* Listening the channel event */
global.eventStatus.on('your channel name', function(data) {
// handle the data.
});
/* emit the channel event */
global.eventStatus.on('your channel name', 'your data')
Example
global.eventStatus.on('info', function(data) {
print(data); // it will print `hello world` in every 2s.
})
__timer(function() {
global.eventStatus.emit('info', 'hello world!');
}, 2000);