louie
v0.0.1
Published
Louie is a timeable infinite loop for executing tasks.
Downloads
3
Readme
louie
Louie is a timeable loop for executing tasks written in JavaScript.
Getting Started
var louie = new Louie();
louie.addTask({
timeout: 10000,
task: function() {
console.log('called after 10000ms');
}
});
louie.addTask({
timeout: 50000,
task: function() {
console.log('called after 15000ms');
}
});
louie.start();
API
addTask(task)
Adds a task to the queue. task
is an object with the properties task
and timeout
(optional).
louie.addTask({
timeout: 1000,
task: function() {}
});
getTasks()
Returns an Array of tasks.
tasks = louie.getTasks()
isRunning()
Can be used to check if the loop is running.
louie.isRunning()
start()
Starts the loop.
louie.start()
louie.isRunning() // true
stop()
Stops the loop.
louie.stop()
louie.isRunning() // false
License
Licensed under the MIT license.