common-emitter

0.0.1 • Public • Published

EventEmitter Everywhere… Excelsior!

Sorry, couldn't resist the alliteration. One of the ironies of the emergence of NodeJS is that for all the glory it brings to Javascript it also is at odds with the place where Javascript has reigned supreme for many years, the browser. Most of the NodeJS libraries are unavailable in the browser. The Events module's EventEmitter was one of those features that exists NodeJS side but not in the browser. This was mostly limiting not because the browser couldn't handle it but because writing code that could / should run everywhere needed to becareful to use common libraries. Common-Emitter is meant to help alleviate that issue.

Installation

npm install common-emitter

Usage

Use exactly like you would EventEmitter. When running in a NodeJS environment it actually just facilitates the requiring of EventEmitter. But when running in a browser environment Common-Emitter provides the common interface so you can write code that run everywhere Javascript does.

The excellent Underscore library is needed for the browser implementation. This is required from within the Common-Emitter code. Using a server like Proxy-Hem or a server that uses Stitch will make it so this is a non-issue. Otherwise, Common-Emitter will check to see if '_' is in the window object so simple load the underscore script first and you should be fine.

Readme

Keywords

none

Package Sidebar

Install

npm i common-emitter

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • brec-c