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

Function then

libraries/p5.js:164–189  ·  view source on GitHub ↗
(onFulfillment, onRejection)

Source from the content-addressed store, hash-verified

162}
163
164function then(onFulfillment, onRejection) {
165 var _arguments = arguments;
166
167 var parent = this;
168
169 var child = new this.constructor(noop);
170
171 if (child[PROMISE_ID] === undefined) {
172 makePromise(child);
173 }
174
175 var _state = parent._state;
176
177 if (_state) {
178 (function () {
179 var callback = _arguments[_state - 1];
180 asap(function () {
181 return invokeCallback(_state, child, callback, parent._result);
182 });
183 })();
184 } else {
185 subscribe(parent, child, onFulfillment, onRejection);
186 }
187
188 return child;
189}
190
191/**
192 `Promise.resolve` returns a promise that will become resolved with the

Callers

nothing calls this directly

Calls 4

makePromiseFunction · 0.85
asapFunction · 0.85
invokeCallbackFunction · 0.85
subscribeFunction · 0.85

Tested by

no test coverage detected