Skip to content

Commit

Permalink
feat: add SW reload event mechanism (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
rentallect authored Aug 5, 2022
1 parent bbf7287 commit 5a69d98
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,22 @@ if (isUndefined(window.zitiBrowzerRuntime)) {

setTimeout(function() {
zitiBrowzerRuntime.logger.debug(`################ doing root-page page reload now ################`);
window.location.replace('https://' + this.zitiConfig.httpAgent.self.host + '/');
window.location.replace('https://' + zitiBrowzerRuntime.zitiConfig.httpAgent.self.host + '/');
}, 100);
}

else if (event.data.type === 'RELOAD') {

zitiBrowzerRuntime.logger.info(`A ${event.data.type} msg was received!`);

zitiBrowzerRuntime.toastWarning(`ServiceWorker initiated a reload - stand by`);

setTimeout(function() {
zitiBrowzerRuntime.logger.debug(`################ doing root-page page reload now ################`);
window.location.replace('https://' + zitiBrowzerRuntime.zitiConfig.httpAgent.self.host + '/');
}, 2500);
}

else if (event.data.type === 'ZITI_CONFIG_NEEDED') {

zitiBrowzerRuntime.wb.messageSW({
Expand Down

0 comments on commit 5a69d98

Please sign in to comment.