MCPcopy
hub / github.com/cujojs/when / when

Function when

when.js:82–89  ·  view source on GitHub ↗

* Get a trusted promise for x, or by transforming x with onFulfilled * * @param {*} x * @param {function?} onFulfilled callback to be called when x is * successfully fulfilled. If promiseOrValue is an immediate value, callback * will be invoked immediately. * @param {function?} onRe

(x, onFulfilled, onRejected, onProgress)

Source from the content-addressed store, hash-verified

80 * callback and/or errback is not supplied.
81 */
82 function when(x, onFulfilled, onRejected, onProgress) {
83 var p = Promise.resolve(x);
84 if (arguments.length < 2) {
85 return p;
86 }
87
88 return p.then(onFulfilled, onRejected, onProgress);
89 }
90
91 /**
92 * Creates a new promise whose fate is determined by resolver.

Callers 15

sequence.jsFile · 0.85
bindCallbackFunction · 0.85
timeout.jsFile · 0.85
guardFunction · 0.85
poll.jsFile · 0.85
voteFunction · 0.85
allFunction · 0.85
settleFunction · 0.85
mapFunction · 0.85
filterFunction · 0.85
delay.jsFile · 0.85
mapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…