eventbase

0.0.2 • Public • Published

eventbase

Tiny custom event implementation. Used for more complex system as infrastructure.

Installation

for Node:

$ npm install eventbase

for Browser:

<script src="path/to/eventbase.js"></script>

for Require.js

require.config({
  paths: {
    eventbase: "path/to/eventbase.js"
  }
});
require(["eventbase"], function (EventBase) {
  // TODO
});

Usage

var base = new EventBase();
base.on('eventname', function (message) {
  console.log(message);
  // => Hello world!
});
base.fire('eventname', {message: 'Hello world!'});
// and
base.once('eventname', function (data) {
  // TODO
});
base.unbind('eventname'/*, fn */);

License

The MIT License

Readme

Keywords

Package Sidebar

Install

npm i eventbase

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • jacksontian