Emitter
emitter
Author: Firede(firede@firede.us)
Example
var emitter = new Emitter();
emitter.on('foo', function(value) {
console.log(value);
});
// console.log: 'test'
emitter.emit('foo', 'test');
- Emitter
- Emitter ⏏
- new Emitter()
- .mixin(obj) ⇒
Object
- Emitter ⏏
Emitter ⏏
new Emitter()
Create a emitter instance
Emitter.mixin(obj) ⇒ Object
将Emitter混入目标对象
Kind: static method of Emitter
Returns: Object
- 混入Emitter后的对象
Param | Type | Description |
---|---|---|
obj | Object |
目标对象 |