* Updates the current client (i.e. browser tab) to the latest version that is ready for * activation. * * In most cases, you should not use this method and instead should update a client by reloading * the page. * * * * Updating a
()
| 123 | * - rejects if any error occurs |
| 124 | */ |
| 125 | activateUpdate(): Promise<boolean> { |
| 126 | if (!this.sw.isEnabled) { |
| 127 | return Promise.reject( |
| 128 | new RuntimeError( |
| 129 | RuntimeErrorCode.SERVICE_WORKER_DISABLED_OR_NOT_SUPPORTED_BY_THIS_BROWSER, |
| 130 | (typeof ngDevMode === 'undefined' || ngDevMode) && ERR_SW_NOT_SUPPORTED, |
| 131 | ), |
| 132 | ); |
| 133 | } |
| 134 | const nonce = this.sw.generateNonce(); |
| 135 | return this.sw.postMessageWithOperation('ACTIVATE_UPDATE', {nonce}, nonce); |
| 136 | } |
| 137 | } |
no test coverage detected