Skip to content

Instantly share code, notes, and snippets.

@iamdustan
Created January 24, 2013 18:04
Show Gist options
  • Save iamdustan/4625834 to your computer and use it in GitHub Desktop.
Save iamdustan/4625834 to your computer and use it in GitHub Desktop.
define([
], function () {
var Module, exports;
Module = function (app) {
this.app = app();
this.init();
}
Module.prototype = {
init: function () {
this.registerTemplates();
this.bindEvents();
},
registerTemplates: function () {
},
bindEvents: function () {
var app = this.app;
this.on('module-event', function (data) {
app.emit('event-from-module', data);
});
}
};
// all of these methods have `this` bound to the app
exports = {
init: function(cb) {
var app = this;
app.stageManager = new Module(app);
app.on('events-from-app', function () {});
cb();
},
detach: function(cb) {
cb();
}
}
return exports;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment