npm.io
1.1.0 • Published 12 years ago

ordine

Licence
Beerware
Version
1.1.0
Deps
0
Vulns
0
Weekly
0
Stars
12

alt text

Callbacks made almost easy

Simple queue system to handle callbacks

Constructor :

    var myQueue = new Ordine(function(){
      console.log('uh!?')
    })

Constructor arguments :

callback(function): This the only required argument which is the callback for the queue.

#Enqueue method :


    var myQueue = new Ordine(function(){
      console.log('uh!?')
    })
    .enqueue(function(){

      window.setTimeout(function(){
        console.log('first')
        myQueue.next()
      },1000);
    })

    .enqueue(function(){
      window.setTimeout(function(){
        console.log('second')
        myQueue.next()
      },1000);
    },false)

    .enqueue(function(){
      window.setTimeout(function(){
        console.log('third')
        myQueue.next()
      },1000);
    },true)
    .run()

Enqueue arguments :

Proccess(function):

Asynchronous stuff.

Sync(boolean):

This argument have to be the answer for the question : "This process will wait the previous process end to be executed"

Run Method :

The run method trigger the queue execution.

// Cycle Icon designed by Nick Remis - http://www.thenounproject.com/nremis/

Keywords