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

Function publish

libraries/p5.js:385–409  ·  view source on GitHub ↗
(promise)

Source from the content-addressed store, hash-verified

383}
384
385function publish(promise) {
386 var subscribers = promise._subscribers;
387 var settled = promise._state;
388
389 if (subscribers.length === 0) {
390 return;
391 }
392
393 var child = undefined,
394 callback = undefined,
395 detail = promise._result;
396
397 for (var i = 0; i < subscribers.length; i += 3) {
398 child = subscribers[i];
399 callback = subscribers[i + settled];
400
401 if (child) {
402 invokeCallback(settled, child, callback, detail);
403 } else {
404 callback(detail);
405 }
406 }
407
408 promise._subscribers.length = 0;
409}
410
411function ErrorObject() {
412 this.error = null;

Callers 1

publishRejectionFunction · 0.85

Calls 1

invokeCallbackFunction · 0.85

Tested by

no test coverage detected