0.1.5 • Published 7 years ago

obj-emitter v0.1.5

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

obj-emitter

Emit anything you want. If object is suitable then object will be handled by callback. Optionally you can use this way to emit booleans, strings, numbers, symbols, arrays

Example

const objEmitter = new ObjEmitter();
objEmitter.on({a:1, b:2}, obj => console.log('Emits', obj));

objEmitter.emit({a:1, b:2});       //Emits {a:1, b:2}
objEmitter.emit({a:1, b:2, c:3});  //Emits {a:1, b:2, c:3}
objEmitter.emit({a:2, b:5});       //do not call handler

const cb = o => console.log(o);
objEmitter.on({x: 1, y: {z: 'test'}, cb);
objEmitter.removeListener({x: 1, y: {z: 'test'}, cb);  //removing listener

objEmitter.removeAllListeners({a:1, b:2}); //remove all listeners of this object pattern
0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago