Skip to content

Instantly share code, notes, and snippets.

@jcblw
Created August 31, 2013 04:34
Show Gist options
  • Save jcblw/6396231 to your computer and use it in GitHub Desktop.
Save jcblw/6396231 to your computer and use it in GitHub Desktop.
var Test = Marrow( function Test ( options ) {
this.options = options;
},{
trigger: function ( ) {
this.emit( 'testEvent' );
}
}),
Listener = Marrow( function Listener ( ) { } ),
listener = new Listener( );
listener.on( Test, 'testEvent', function ( ) {
console.log( 'testEvent fired' );
});
var test = new Test( ),
test2 = new Test( );
test.trigger( );
test2.trigger( );
// should console log 'testEvent fired' twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment