ee-event
0.1.1 • Public • Published ee-event
var Class = require( "ee-class" )
, Events = require( "ee-event" );
var Human = new Class( {
inherits: Events
, name: ""
, age: 29
, init: function( options ){
this.name = options.name;
}
, sayHello: function( to ){
this.emit( "startHello" );
console.log( "Hi %s, my name is %s and i'm %i years old.", to, this.name, this.age );
this.emit( "endHello" );
}
} );
var Boy = new Class( {
inherits: Human
, age: 12
} );
var fabian = new Boy( {
name: "Fabian"
, on: {
startHello: function(){ console.log( "starting console output:" ); }
endHello: function(){ console.log( "finished console output!" ); }
}
} );
fabian.sayHello(); // starting console output:
// Hi my name is Fabian and i'm 12 years old.
// finished console output!
Readme
Keywords
nonePackage Sidebar
Install
Weekly Downloads