Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created October 16, 2009 06:38
Show Gist options
  • Select an option

  • Save lsmith/211608 to your computer and use it in GitHub Desktop.

Select an option

Save lsmith/211608 to your computer and use it in GitHub Desktop.
function A() { Y.Widget.apply(this,arguments); };
Y.extend(A, Y.Widget);
A.NAME = 'a';
function B() { Y.Widget.apply(this,arguments); };
Y.extend(B, Y.Widget);
B.NAME = 'b';
var a = new A(),
b = new B();
b.addTarget(a);
b.publish("evt", {
type: 'evt', // remove this and both subscribers execute
emitFacade: true,
bubbles: true,
preventable: false,
queuable: false
});
a.on("b:evt", function (e) {
alert("here 1");
});
b.on("evt", function (e) {
alert("here 2");
});
b.fire("evt");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment