0.7.2 • Published 10 years ago

browser-emitter v0.7.2

Weekly downloads
3
License
-
Repository
github
Last release
10 years ago

browser-emitter

Rank

Version Build status

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'); // => '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'); // => ['a', 'b', 'c']

</script>

if you want to inherit Emitter to another class, use prototype chain.

    // for Factory
    var SubClass = function(){
      Emitter.call(this);
    }
    Emitter.inherits(SubClass);
0.7.2

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.5.0

10 years ago

0.4.0

11 years ago

0.3.1

11 years ago

0.3.0

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago

0.0.1

11 years ago