Created
February 23, 2015 21:16
-
-
Save devdays/2d3a2014a98148c43336 to your computer and use it in GitHub Desktop.
Calling the Add Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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