browser-emitter
0.7.2 • Public • Published browser-emitter
Simple Event Emitter for browser. Using object as the agent of events.
You can use this both node and browsers.
Install
Install with npm:
npm install browser-emitter
API - Set functions by args
var Emitter = require('browser-emitter');
var emitter = new Emitter();
emitter.on('hoge', function(){ console.log(arguments) });
emitter.emit('hoge', 'a', 'b', 'c');
also use on browser
<script type="text/javascript" src="Emitter.js"></script>
<script type="text/javascript">
var emitter = new Emitter();
emitter.on('hoge', function(){ console.log(arguments) });
emitter.emit('hoge', 'a', 'b', 'c');
</script>
if you want to inherit Emitter to another class, use prototype chain.
var SubClass = function(){
Emitter.call(this);
}
Emitter.inherits(SubClass);
Versions
Current Tags
- VersionDownloads (Last 7 Days)
- 0.7.2
5
Version History
Package Sidebar
Install
Weekly Downloads