Skip to content

Instantly share code, notes, and snippets.

@panych
Created September 29, 2015 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panych/ca46b8d2d52ad03b2930 to your computer and use it in GitHub Desktop.
Save panych/ca46b8d2d52ad03b2930 to your computer and use it in GitHub Desktop.
function funnyURL(word, interval, prevID) {
prevID = prevID ? prevID : this.prevID; // assume that undefined is OK
clearInterval(prevID);
var i = 0, ID;
ID = setInterval(function() {
history.replaceState(null, '', word.slice(0,i+1));
i = i+1;
if (i >= word.length) clearInterval(ID);
}, interval);
return this.prevID = ID;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment