mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Merge pull request #377 from EDCD/feature/please-willy
wait for load event before registering service worker
This commit is contained in:
@@ -324,6 +324,7 @@ export default class Coriolis extends React.Component {
|
||||
// Listen for appcache updated event, present refresh to update view
|
||||
// Check that service workers are registered
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
// Your service-worker.js *must* be located at the top-level directory relative to your site.
|
||||
// It won't be able to control pages unless it's located at the same level or higher than them.
|
||||
// *Don't* register service worker file in, e.g., a scripts/ sub-directory!
|
||||
@@ -363,6 +364,7 @@ export default class Coriolis extends React.Component {
|
||||
}).catch(function(e) {
|
||||
console.error('Error during service worker registration:', e);
|
||||
});
|
||||
});
|
||||
}
|
||||
window.onerror = this._onError.bind(this);
|
||||
window.addEventListener('resize', () => this.emitter.emit('windowResize'));
|
||||
|
||||
Reference in New Issue
Block a user