Skip to content

Instantly share code, notes, and snippets.

@dspangen
Last active December 20, 2015 22:48
Show Gist options
  • Save dspangen/6207532 to your computer and use it in GitHub Desktop.
Save dspangen/6207532 to your computer and use it in GitHub Desktop.
define(["backbone", "backbone.marionette", "backbone.epoxy", "views/mixins/epoxyCustomBindingHandlers", "views/mixins/epoxyCustomBindingFilters"],
function(Backbone, Marionette, Epoxy, EpoxyCustomBindingHandlers, EpoxyCustomBindingFilters) {
// Base set of functions that can be mixed into standard views such as ItemViews, CompositeViews, etc.
return {
bindingHandlers: EpoxyCustomBindingHandlers,
bindingFilters: EpoxyCustomBindingFilters,
epoxyBindingEnabled: true,
initialize: function(options) {
if (this.epoxyBindingEnabled) {
this.epoxify();
}
this.triggerMethod("initialize");
},
epoxify: function() {
Epoxy.View.mixin(this);
this.listenTo(this, "ui:bind", this.applyBindings);
this.listenTo(this, "before:close", this.removeBindings);
},
// Override Marionette's impl so we can trigger our own event
bindUIElements : function() {
this.trigger("ui:bind");
Marionette.View.prototype.bindUIElements.apply(this, arguments);
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment