(
executor: (
resolve: (value?: R | PromiseLike<R>) => void,
reject: (error?: any) => void,
) => void,
)
| 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; |
nothing calls this directly
no test coverage detected