Nascent Plasticine Materialist
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    ee-eventpublic

    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!

    Keywords

    none

    install

    npm i ee-event

    Downloadsweekly downloads

    4

    version

    0.1.1

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar