Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
eprom
is an enhanced promise implementation. It works by wrapping a globally available Promise
class and is as compliant with the Promises/A+ spec as the global Promise
is.
In addition to the usual then
, call
and finally
instance methods, it provides resolve
and reject
methods. In this regard, it resembles jQuery's Deferred
object. On top of that, it features a reset
method that enables repeat fulfillment.
Using NPM:
npm install -S eprom
Using Yarn:
yarn add eprom
eprom
's EnhancedPromise
mimics more usual Promises
in every way. As such, it provides all class (resolve
, reject
, all
, race
) and instance (then
, catch
, finally
) methods these provide.
enhancedPromise.resolve(value)
This method resolves an EnhancedPromise
's inner Promise
, triggering the execution of all onFulfilled
handlers.
const enhancedPromise = new EnhancedPromise();
enhancedPromise.then(value => console.log(value));
enhancedPromise.resolve('foo');
// logs 'foo'
enhancedPromise.reject(reason)
This method rejects an EnhancedPromise
's inner Promise
, triggering the execution of all onRejected
handlers.
const enhancedPromise = new EnhancedPromise();
enhancedPromise.catch(reason => console.err(reason));
enhancedPromise.reject('bar');
// logs 'bar'
enhancedPromise.reset()
This method creates a fresh inner Promise
and thus allows for the re-fulfillment of an EnhancedPromise
. A typical use case for this is handling repeat builds triggered by Webpack in watch mode.
const enhancedPromise = new EnhancedPromise();
enhancedPromise.then(value => console.log(value));
enhancedPromise.resolve('foo');
// logs 'foo'
enhancedPromise.reset();
enhancedPromise.then(value => console.log(value));
enhancedPromise.resolve('bar');
// logs 'bar'
1.0.0 (2018-10-24)
<a name="0.0.1"></a>
FAQs
JavaScript Async Primitive
The npm package eprom receives a total of 128 weekly downloads. As such, eprom popularity was classified as not popular.
We found that eprom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.