Skip to content

Instantly share code, notes, and snippets.

@justinwinslow
Last active February 4, 2016 16:06
Show Gist options
  • Save justinwinslow/5274687 to your computer and use it in GitHub Desktop.
Save justinwinslow/5274687 to your computer and use it in GitHub Desktop.
/* Module */
define(['dep'], function(dep){
var Module = {};
// Instantiate a local controller
Module.controller = new Backbone.Controller.extend({
foo: bar
})();
Module.model = Backbone.Model.extend({
url: 'path/to/api'
});
Module.view = Backbone.View.extend({
controller: Module.controller,
model: Module.model,
myMethod: function(data){
console.log(data);
},
initialize: function(models, options){
this.listenTo(this.controller, 'someEvent', function(data){
that.myMethod(data);
});
}
});
return Module;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment