Yes.js is basically a wrapper around the setInterval
and clearInterval
JavaScript functions. Yes.js makes it
a little easier to manage repeating interval calls.
bower install yes.js
or npm install yes.js
Node.js users...var Yes = require('yes.js');
http://bostrt.github.io/yes.js/
var myYes = new Yes();
var yesID = myYes.yes(function(str) {
console.log(str);
}, "Oh yes!", 1000);
// ...
yes.kill(yesID);
function getUserLocation() {
...
}
var myYes = new Yes();
// Same old string
myYes.yes(function(str) {
console.log(str);
}, "Oh Yes!", 1000);
// You can even pass functions!
myYes.yes(function(func) {
console.log("User is at " + func());
}, getUserLocation, 5000);
// ...
// Let's kill both of our intervals.
myYes.kill();