You can tie one promise with another. Tying is mean that when your abort one promise, another one will be aborted too.
To tie a promise, provide a parent promise as the second argument of the constructor or static methods, like all or race.
The method creates a new resolved promise for the specified value.
If the resolved value is a function, it will be invoked.
The result of the invoking will be provided as a value of the promise.
core/promise/abortable
This module provides a class wraps promise-like objects and adds to them some extra functionality, such as possibility of cancellation, etc.
Tied promises
You can tie one promise with another. Tying is mean that when your abort one promise, another one will be aborted too. To tie a promise, provide a parent promise as the second argument of the constructor or static methods, like
all
orrace
.API
The module re-use native Promise API with adding some extra getters, etc., you free to use such methods like
then
,catch
, orfinally
.isPending
True if the current promise is pending.
Helpers
The module provides a bunch of static helper methods and getters.
wrapReasonToIgnore
The method wraps the specified abort reason to ignore with tied promises, i.e., this reason won't reject all child promises.
resolveAndCall
The method creates a new resolved promise for the specified value. If the resolved value is a function, it will be invoked. The result of the invoking will be provided as a value of the promise.