MCPcopy Create free account
hub / github.com/cujojs/poly / when

Function when

test/curl.js:180–189  ·  view source on GitHub ↗
(promiseOrValue, callback, errback, progback)

Source from the content-addressed store, hash-verified

178 }
179
180 function when (promiseOrValue, callback, errback, progback) {
181 // we can't just sniff for then(). if we do, resources that have a
182 // then() method will make dependencies wait!
183 if (isPromise(promiseOrValue)) {
184 return promiseOrValue.then(callback, errback, progback);
185 }
186 else {
187 return callback(promiseOrValue);
188 }
189 }
190
191 /**
192 * Returns a function that when executed, executes a lambda function,

Callers 4

localRequireFunction · 0.85
curl.jsFile · 0.85
getDepFunction · 0.85
CurlApiFunction · 0.85

Calls 1

isPromiseFunction · 0.85

Tested by

no test coverage detected