jmessenger
0.0.3 • Public • Published JMessenger
JMessenger
is a tiny Javascript library to handle messages that carry a payload. It is designed to be embedded in another library.
Quick Startup
var mess = Messenger('mycustomevent');
mess.on('mycustomevent', function(payload) {
console.log('fired mycustomevent: ' + payload);
});
mess.fire('mycustomevent', 'this is the payload for mycustomevent');
API
Static methods
JMessenger provides a set of static methods. You can use by typing:
Static Methods |
Description |
noConflict |
returns the JMessenger variable to its previous owner, |
Create a JMessenger object:
Constructor |
Description |
JMessenger('messagename') |
creates the JMessenger object that handles 'messagename' messages, |
Methods
Methods |
Description |
addEvents |
adds events/messages, |
addEventListener |
adds an event listener, |
removeEventListener |
removes an event listener, |
fire |
fires an event/message, |
on |
alias on addEventListener, |
off |
alias on removeEventListener, |
trigger |
alias on fire, |
License
MIT.
Package Sidebar
Install
Weekly Downloads