Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 604 Bytes

UPGRADE.md

File metadata and controls

41 lines (31 loc) · 604 Bytes

Emitter Upgrade 1.x to 2.x

1.x API

var target = Object.create( null );

// Initialization
Emitter.asEmitter.call( target );
target.defineEvents();
target.defineMaxListeners( 10 );

// Listener count
Emitter.listenerCount( target, 'hello' );

// Casting
target.toJSON();
target.toString();

2.x API

var target = Object.create( null );

// Initialization
Emitter( target );

// Listener count
target.listenerCount( 'hello' );

// Casting
target.toJSON = function(){
    // ...
};
target.toString = function(){
    // ...
};
target.toJSON();
target.toString();