File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 7575
7676 < script >
7777 if ( 'serviceWorker' in navigator ) {
78- window . addEventListener ( 'load' , function ( ) {
79- navigator . serviceWorker . register ( '/sw.js?0166' ) . then ( function ( registration ) {
80- // Successfully registered the Service Worker
81- //console.log('Service Worker registration successful with scope: ', registration.scope);
82- } ) . catch ( function ( err ) {
83- // Failed to register the Service Worker
84- //console.log('Service Worker registration failed: ', err);
85- } ) ;
86- } ) ;
78+
79+ navigator . serviceWorker . getRegistrations ( )
80+ . then ( registrations => {
81+ return Promise . all (
82+ registrations . map ( reg => reg . unregister ( ) )
83+ ) ;
84+ } )
85+
86+ . then ( ( ) => caches . keys ( ) )
87+ . then ( names => {
88+ return Promise . all (
89+ names . map ( name => caches . delete ( name ) )
90+ ) ;
91+ } )
92+
8793 }
8894 </ script >
You can’t perform that action at this time.
0 commit comments