Skip to content

Instantly share code, notes, and snippets.

@koistya
Created June 22, 2011 20:17
Show Gist options
  • Save koistya/1041040 to your computer and use it in GitHub Desktop.
Save koistya/1041040 to your computer and use it in GitHub Desktop.
Closer
var loader = (function() {
var speed = 200,
index = 0,
timeout = null,
symbols = ['└', '├', '┌', '┬', '┐', '┤', '┘', '┴'];
function show() {
console.log(symbols[index]);
index = (index + 1) % symbols.length;
timeout = setTimeout(show, speed);
}
function hide() {
clearTimeout(timeout);
}
return { show: show, hide: hide };
})();
// Testing
loader.show();
setTimeout(function() { loader.hide(); }, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment