- ECMAScript 6 supports
- V8 ≥ 5.0.0
- Node ≥ 6.0.0
- Chrome ≥ 50.0.0
There're two ways to import this class
const XPromiseSet = require('promise-set/x')
const {XPromiseSet} = require('promise-set')
Usage
XPromiseSet(XPromise, XSet)
// XPromise and XSet might be either es6 Promise and Set or custom classes or undefined
It's just XPromiseSet(Promise, Set)
const PromiseSet = require('promise-set')
- Returns: A
XPromise
instance
Equivalent to XPromise::all
- Returns: A
XPromise
instance
Equivalent to XPromise::race
- Arguments: None
- Returns: A
XPromiseSet
instance
- Arguments: Two functions
onfulfill
andonreject
that take 1 argument and return value to resolve or throw exception to reject - Returns: Delivered object of 'this' (
PromiseSet
instance)
- Arguments: Two functions
onfulfill
andonreject
that take 1 argument and return a boolean - Returns: Delivered object of 'this' (
PromiseSet
instance)
const XPromiseSet = require('promise-set/x')
const MyPromiseSet = XPromiseSet(MyPromiseClass, MyIterableSetClass)
const promiseset = new MyPromiseSet(
mypromiseexecutor, // fn (resolve: fn (?) -> void, reject: fn (?) -> void) -> void
mypromiseobject, // instance of MyPromiseClass
...etc
)
promiseset
.mapExecutor(
onfulfill, // fn (val: ?, resolve: fn (?) -> void, reject: fn (?) -> void) -> void
onreject
)
.map(
onfulfill, // fn (val: ?) !> ? -> ?
onreject
)
.filter(
onfulfill, // fn (val: ?) -> bool
onreject
)
MIT