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!
-
Notifications
You must be signed in to change notification settings - Fork 0
js event implementaition
License
linaGirl/ee-event
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
js event implementaition
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published