A small ES6 package for execute functions sequentially.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jose Quintana 0357fc240a v1.0.7 2 years ago
.gitignore up pkgs 2 years ago
.npmignore up pkgs 2 years ago
.travis.yml up pkgs 2 years ago
LICENSE.md up pkgs 2 years ago
README.md up pkgs 2 years ago
index.js up pkgs 2 years ago
package.json v1.0.7 2 years ago
rollup.config.js up pkgs 2 years ago
test.js up pkgs 2 years ago
yarn.lock up pkgs 2 years ago

README.md

Seqr Build Status Coverage Status js-standard-style

A small ES6 package for execute functions sequentially.

Install

Yarn

yarn add seqr --dev

NPM

npm install seqr --save-dev

UMD file is also available on unpkg:

<script src="https://unpkg.com/seqr/dist/seqr.min.js"></script>

You can use the library via window.seqr.

Usage

const seqr = require('seqr')()
const time = () => new Date().getTime()

seqr
  .then(done => {
    setTimeout(() => {
      console.log('Seq 1:', time())
      done()
    }, 1000)
  })
  .then(done => {
    setTimeout(() => {
      console.log('Seq 2:', time())
      done()
    }, 2000)
  })

seqr.then(done => {
  console.log('Seq 3:', time())
  done()
})

// Seq 1: 1468388509127
// Seq 2: 1468388511132
// Seq 3: 1468388511133

Contributions

Pull requests and issues are welcome.

License

MIT license

© 2017 José Luis Quintana