1.0.4 • Published 3 months ago

@mobilabs/messenger v1.0.4

Weekly downloads
11
License
MIT
Repository
github
Last release
3 months ago

Messenger

NPM version GitHub last commit Github workflow Test coverage npm bundle size License

Messenger is a tiny Javascript library to handle messages that carry a payload. It is designed to be embedded in another library. Messenger run on both Node.js and ECMAScript 2015 (ES6) compliant browsers.

Quick Startup

// Listens for an event:
mess.subscribe('mycustomevent', function(payload) {
  console.log('fired mycustomevent: ' + payload);
});

// Fires an event:
mess.publish('mycustomevent', 'this is the payload for mycustomevent');

API

Static methods

Messenger provides a set of static methods. You can use by typing:

Messenger.noConflict();
Static MethodsDescription
noConflictreturns the Messenger variable to its previous owner,

Create a Messenger object:

ConstructorDescription
Messenger()creates the Messenger object that handles messages,

Methods

MethodsDescription
subscribeadds an event listener,
subscribeOnceadds an event listener that is fired once,
unsubscriberemoves an event listener,
publishfires an event/message,

License

MIT.

1.0.4

3 months ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.4-beta.1

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

5 years ago

0.0.0

5 years ago