Skip to content

Instantly share code, notes, and snippets.

@devdays

devdays/addMethod.js

Created Feb 23, 2015
Embed
What would you like to do?
Calling the Add Method
(function ($) {
$.widget("custom.clicker", {
// Default options.
options: {
startingValue: 0,
_currentValue : 0
},
// _create and other methods to access properties ommitted ..
add: function (val) {
if (val === undefined) {
this.options._currentValue++;
} else {
this.options._currentValue += val;
}
}
});
}(jQuery));
myClicker.clicker("add");
myClicker.clicker("add", 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment