MCPcopy
hub / github.com/angular/angular / checkForUpdate

Method checkForUpdate

packages/service-worker/src/update.ts:85–99  ·  view source on GitHub ↗

* Checks for an update and waits until the new version is downloaded from the server and ready * for activation. * * @returns a promise that * - resolves to `true` if a new version was found and is ready to be activated. * - resolves to `false` if no new version was found * - rejec

()

Source from the content-addressed store, hash-verified

83 * - rejects if any error occurs
84 */
85 checkForUpdate(): Promise<boolean> {
86 if (!this.sw.isEnabled) {
87 return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));
88 }
89 if (this.ongoingCheckForUpdate) {
90 return this.ongoingCheckForUpdate;
91 }
92 const nonce = this.sw.generateNonce();
93 this.ongoingCheckForUpdate = this.sw
94 .postMessageWithOperation('CHECK_FOR_UPDATES', {nonce}, nonce)
95 .finally(() => {
96 this.ongoingCheckForUpdate = null;
97 });
98 return this.ongoingCheckForUpdate;
99 }
100
101 /**
102 * Updates the current client (i.e. browser tab) to the latest version that is ready for

Callers 4

comm_spec.tsFile · 0.45
updateCheckMethod · 0.45
constructorMethod · 0.45

Calls 4

generateNonceMethod · 0.80
finallyMethod · 0.80
rejectMethod · 0.45

Tested by

no test coverage detected