Skip to Content

unregisterServiceWorker()

Unregister all service workers.

JavaScript February 8, 2021

Usage

JavaScript
nebula.unregisterServiceWorker()

Parameters

This function does not accept any parameters. Is this incorrect?

Source File

Located in /assets/js/modules/optimization.js on line 254.

No Hooks

This function does not have any filters or actions available. Request one?
JavaScript
nebula.unregisterServiceWorker = function(){
    if ( 'serviceWorker' in navigator ){
        navigator.serviceWorker.getRegistrations().then(function(registrations){
            for ( let registration of registrations ){
                registration.unregister();
            }
        });
    }
};

Override

To override or disable this JavaScript function, simply redeclare it with the exact same function name.

JavaScript
nebula.unregisterServiceWorker = function(){
    //Write your own code here, leave it blank, or return false.
}