MCPcopy Index your code
hub / github.com/angular/angular / constructor

Method constructor

packages/zone.js/lib/common/promise.ts:496–518  ·  view source on GitHub ↗
(
        executor: (
          resolve: (value?: R | PromiseLike<R>) => void,
          reject: (error?: any) => void,
        ) => void,
      )

Source from the content-addressed store, hash-verified

494 }
495
496 constructor(
497 executor: (
498 resolve: (value?: R | PromiseLike<R>) => void,
499 reject: (error?: any) => void,
500 ) => void,
501 ) {
502 const promise: ZoneAwarePromise<R> = this;
503 if (!(promise instanceof ZoneAwarePromise)) {
504 throw new Error('Must be an instanceof Promise.');
505 }
506 (promise as any)[symbolState] = UNRESOLVED;
507 (promise as any)[symbolValue] = []; // queue;
508 try {
509 const onceWrapper = once();
510 executor &&
511 executor(
512 onceWrapper(makeResolver(promise, RESOLVED)),
513 onceWrapper(makeResolver(promise, REJECTED)),
514 );
515 } catch (error) {
516 resolvePromise(promise, false, error);
517 }
518 }
519
520 get [Symbol.toStringTag]() {
521 return 'Promise' as any;

Callers

nothing calls this directly

Calls 3

onceFunction · 0.85
makeResolverFunction · 0.85
resolvePromiseFunction · 0.85

Tested by

no test coverage detected