Skip to content

flroux/promise-line

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queuing some promises

It is sometimes necessary to synchronize parts of asynchronous processes in order to guarantee coherency (for instance database coherency when the database engine does not support transactions). Promise lines can help in these particular cases.

Usage

Get the package:

npm install --save promise-line

Get a Promise line:

const promiseLine = require('promise-line')
const line = promiseLine()

Then push some promise factories:

line.push(() => new Promise((resolve, reject) => { /* promise 1 resolution */ }))
line.push(() => new Promise((resolve, reject) => { /* promise 2 resolution */ }))
line.push(() => new Promise((resolve, reject) => { /* promise 3 resolution */ }))

The line can be used in different unrelated parts of your code in order to avoid mangling critical sections.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%