Events
Event management functions
createEventManager
Create a event managment object
events {object}
: Where all events are registredregister {function}(key {string}, callback {function})
: Register a eventemmit {function}(key {string}, args {!any})
: Call all registred function with the key,args
are opcional
const evts = _.createEventManager();
evts.register('user_registred', username => {
alert(`Thank you, ${username}`);
});
evts.emmit('user_registred', 'Alex');
// alerts 'Thank you, Alex'
events
Global events
_.events.register('user_registred', username => {
alert(`Thank you, ${username}`);
});
_.events.emmit('user_registred', 'Alex');
// alerts 'Thank you, Alex'