1.0.8 • Published 4 years ago

roujecallsync v1.0.8

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Docs

const call = require('./roujeCallSync')

// ENV
const tada = (cb) => cb('woho ')
const todo = (cb) => cb(console.log('whoa '))
const sleep3 = callback => setTimeout(() => callback(console.log('slept for 3 seconds')), 3000)
const sleep1 = callback => setTimeout(() => callback('slept for 1 seconds'), 3000)

// TEST 1
console.log('starting')

call.do(() => {
    tada(() => {
        console.log('operation done')
        call.done()
    })
})

console.log('end')

// TEST 2
a = call.sync(tada)
b = call.sync(sleep1)

console.log(a + b)

// TEST 3
call.chain(todo, sleep3, todo, () => console.log('done'))

This basic example shows how to use the library, in reality you have a ton of nesting that you know is wrong.

1.0.8

4 years ago

1.0.7

4 years ago

1.0.5

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago