Created
December 8, 2014 23:19
-
-
Save DrSammyD/2dbc9cce7ca8a978a7dc to your computer and use it in GitHub Desktop.
function which repeats an id a set amount of times and then increments
This file contains hidden or 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
var repeat= function(reps){ | |
var repeatOrig=ko.repeat; | |
repeatOrig.uid=!repeatOrig.uid?1:repeatOrig.uid+1; | |
var times = reps-1; | |
var repetion= function(){ | |
if(--times<=0) | |
ko.repeat=repeatOrig; | |
return repeatOrig.uid; | |
}; | |
ko.repeat=repetion; | |
return repeatOrig.uid; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment