2.1.0 • Published 10 months ago

despot v2.1.0

Weekly downloads
4
License
ISC
Repository
github
Last release
10 months ago

Despot

A global event bus driven by a singleton event emitter class. Use this module to hook something in other objects.

Originally forked from https://github.com/teawithfruit/node-singleton-event with the difference that it also works on silly browsers ... IE.

Beware it's very controversial to have a singleton acting as an event emitter. Depends on your app architecture. The fact that nodejs/iojs caches any module.exports makes it easy to build one. IMO it's useful for rapid prototyping but not recommended for high performance apps.

Install

npm i -S despot

How to use

Require it in every file where you want to communicate with another file.

Say something:

var despot = require("despot");
despot.emit("talk", "hello world");

Receive something:

var despot = require("despot");
despot.on("talk", function (value) {
  console.log(value);
});
2.1.0

10 months ago

2.0.0

11 months ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

10 years ago