Skip to content

Instantly share code, notes, and snippets.

@VinSpee
Created January 25, 2013 18:18
Show Gist options
  • Save VinSpee/4636634 to your computer and use it in GitHub Desktop.
Save VinSpee/4636634 to your computer and use it in GitHub Desktop.
(function() {
define(["jquery"], function($) {
var Toggle;
Toggle = (function() {
function Toggle(context, toggle, toggler, togglable, callback) {
this.context = context;
this.$context = $(this.context);
this.$toggle = $(this.context).find(toggle);
this.$toggler = $(this.context).find(toggler);
this.$togglable = $(this.context).find(togglable);
this.callback = callback;
console.log(this.doToggle);
this.$toggler.on("click", this.doToggle(this.$togglable));
console.log(this);
}
Toggle.prototype.doToggle = function(togglable) {
return console.log("clicked");
};
return Toggle;
})();
return Toggle;
});
}).call(this);
(function() {
define(["autocomplete", "duplicate-item", "toggler"], function(autocomplete, Filter, Toggler) {
return {
initialize: function() {
var resultsToggler;
return resultsToggler = new Toggler(".results", "[data-widget=toggle]", "[data-widget-component=toggler]", "[data-widget-component=togglable]");
}
};
});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment