Skip to content

Instantly share code, notes, and snippets.

@jstrimpel
Created September 18, 2012 14:54
Show Gist options
  • Save jstrimpel/3743562 to your computer and use it in GitHub Desktop.
Save jstrimpel/3743562 to your computer and use it in GitHub Desktop.
Marionette Extensions
NS.Application = Marionette.Application.extend({
constructor: function () {
var that = this, events;
Marionette.Application.prototype.constructor.apply(this, arguments);
events = {
on: function (topic, func, object) {
this.vent.on(topic, func, (object ? object : undefined));
},
trigger: function (topic, options) {
this.vent.trigger(topic, options);
}
};
this.e = {};
this.e.on = _.bind(events.on, this);
this.e.trigger = _.bind(events.trigger, this);
}
});
NS.Application = Marionette.View.extend({
constructor: function () {
var that, ctl;
Marionette.View.prototype.constructor.apply(this, arguments);
ctl = this.options.ctl;
that = this;
this.on('close', function (o) { ctl.vent.off(null, null, this); });
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment