MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / handleForeignThenable

Function handleForeignThenable

libraries/p5.js:270–297  ·  view source on GitHub ↗
(promise, thenable, then)

Source from the content-addressed store, hash-verified

268}
269
270function handleForeignThenable(promise, thenable, then) {
271 asap(function (promise) {
272 var sealed = false;
273 var error = tryThen(then, thenable, function (value) {
274 if (sealed) {
275 return;
276 }
277 sealed = true;
278 if (thenable !== value) {
279 _resolve(promise, value);
280 } else {
281 fulfill(promise, value);
282 }
283 }, function (reason) {
284 if (sealed) {
285 return;
286 }
287 sealed = true;
288
289 _reject(promise, reason);
290 }, 'Settle: ' + (promise._label || ' unknown promise'));
291
292 if (!sealed && error) {
293 sealed = true;
294 _reject(promise, error);
295 }
296 }, promise);
297}
298
299function handleOwnThenable(promise, thenable) {
300 if (thenable._state === FULFILLED) {

Callers 1

handleMaybeThenableFunction · 0.85

Calls 5

asapFunction · 0.85
tryThenFunction · 0.85
_resolveFunction · 0.85
fulfillFunction · 0.85
_rejectFunction · 0.85

Tested by

no test coverage detected