Skip to content

Instantly share code, notes, and snippets.

@ahume
Last active August 29, 2015 14:22
Show Gist options
  • Save ahume/3b5c98c97500eadcb05a to your computer and use it in GitHub Desktop.
Save ahume/3b5c98c97500eadcb05a to your computer and use it in GitHub Desktop.
withNoopToggle
define(function () {
return withNoopToggle;
function withNoopToggle() {
/**
* If toggle is false, do not execute named methods.
*/
this.noopToggle = function (methods, toggle) {
methods.forEach(function (method) {
this.around(method, function (originalFunction) {
if (toggle) {
originalFunction();
}
})
});
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment