Skip to content

Instantly share code, notes, and snippets.

@wenbing
Created June 4, 2013 05:54
Show Gist options
  • Save wenbing/5703877 to your computer and use it in GitHub Desktop.
Save wenbing/5703877 to your computer and use it in GitHub Desktop.
var Y = require('yui').YUI({useSync: true, filter: 'debug' });
Y.use('event-custom', 'oop');
function A(parent) {
if(parent) {
this.parent = parent;
this.addTarget(parent);
}
}
A.name = 'a';
Y.augment(A, Y.EventTarget, false, null, { emitFacade: true });
var a = new A();
a.on('test', function(e) {
console.log(e.type);
console.log(Y.stamp(e.currentTarget));
});
var b = new A(a);
b.on('test', function(e) {
console.log(e.type);
console.log(Y.stamp(e.currentTarget));
});
b.fire('test');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment