elapsed.js
elapsed.js is a simple wrapper of setTimeout
and aims readability improvement of setTimeout
.
usage
basic use
elapsed(500).then(function () {
"do something";
});
nested use
elapsed(500).then(function () {
"do something";
elapsed(300).then(function () {
"do other things";
elapsed(400).then(function () {
"do other things";
});
})
});
cancel callback
var timer = elapsed(3000).then(function () {
"do something";
});
$('#button').click(function () {
timer.cancel();
});