1.0.0 • Published 10 years ago

eventemitter-rx v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

EventEmitterRx

EventEmitter using RxJS.

Install

Source by npm

$ npm install --save-dev eventemitter-rx

or by jspm

$ jspm install --save eventemitter-rx

TSD files are available at our stylelab-io/DefinitelyTyped fork

$ tsd install eventemitter-rx --save

Build

$ npm run start

Usage

// import of EventEmitter
import EventEmitter from 'eventemitter-rx';

// create an instance of it
const emitter:EventEmitter = new EventEmitter();

// dispatching an event
const EVENT:string = 'myEvent';
emitter.next(EVENT);

// dispatching an event with data
const DATA: string = 'myData';
emitter.next(EVENT, DATA);

// subscribing to an event
emitter.subscribe(EVENT, () => {
    console.log('handle event');
});

// subscribing to an event and handling of its data
emitter.subscribe(EVENT, (DATA) => {
    console.log('event data', DATA);
});

// unsubscribing to an event
var observer:Rx.IDisposable = emitter.subscribe(EVENT, () => {
    console.log('handle event');
});
observer.dispose();

Test

Running tests

Clone project:

$ git clone https://github.com/stylelab-io/event-emitter-rx.git && cd $_

Install dependencies (only once):

$ npm i

Run tests:

$ npm test

Release History

History

License

MIT license.

1.0.0

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago