ff0000/rosy — pull request #71 by gigafied (2012-11-07 22:17:28+00:00)
Title: Add support for pseudo-events to Classes via on, off and trigger methods

//#### PARENT ####

define(

[
"rosy/base/Class",
"SomeModule",
"$"
],

function (Class, SomeModule) {

"use strict";

return Class.extend({

module : null,

init : function () {
this.module = new SomeModule();
this.module.on("something", this.doSomething);
},

doSomething : function () {
console.log("something!");
}
});
}
);

//#### SomeModule ####

define(

[
"rosy/base/Class",
"$"
],

function (Class) {

"use strict";

return Class.extend({

$content : null,
events : [
"something"
],

init : function () {

this.setTimeout(function () {
this.trigger("something");
}, 1000);
}
});
}
);