Skip to content

linaGirl/ee-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

js event implementaition

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published