0.0.4 • Published 6 years ago

benzeno v0.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

benzeno

yet another async parallel tool. But declarative and recursive.

This code help me to think

install

$ npm install benzeno --save

usage

const Benzeno = require('benzeno')

const ring = {
  ben100(cb){
    setTimeout(() => {
      cb( null ,`tout100 delay: ${Date.now()-this.t0}`)
    }, 100)
  },
  ben300(cb){
    setTimeout(() => {
      cb( null, `tout300 delay: ${Date.now()-this.t0}`)
    }, 300)
  },
  benerr(cb){
    setTimeout(() => {
      cb( "its dizzy" )
    }, 0)
  },
  t0: Date.now()
}

const ben = Benzeno(ring)
ben( (err, r) => {
  console.dir(r)
})

/*
{
  t0: 1511800544979,
  benerr: [ 'its dizzy' ],
  ben100: [ null, 'tout100 delay: 101' ],
  ben300: [ null, 'tout300 delay: 301' ]
}
*/

usage minifed at browser

<!-- append at head -->
<script src="https://cdn.jsdelivr.net/npm/benzeno/benzeno.browser.min.js">
  // Global window.Benzeno
  var ring = { nofunction: true }
  var ben = Benzeno(ring)
  ben( (err, r) => {
    console.dir(r)
  })
</script>
0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago