Interface: RegisterSWOptions

Properties

createWorkbox?

optional createWorkbox: CreateWorkboxFn

workbox-window is lazy loaded by default if you're, for example, already lazy loading the virtual module you might want to minimize the number of generated chunks by importing workbox-window synchronously


immediate?

optional immediate: boolean

Setting this to true will register the SW immediately, even if the window has not loaded.


onNewSwActive()?

optional onNewSwActive: () => void

The new SW is controlling the page. You might want to refresh the page.

Returns

void


onNewSwWaiting()?

optional onNewSwWaiting: () => void

The new SW is waiting for activation. You may prompt the user and send "SKIP_WAITING" message to the SW.

Returns

void


onOfflineReady()?

optional onOfflineReady: () => void

The SW is installed.

Returns

void


onRegister()?

optional onRegister: (event) => void

The SW is registered.

Parameters

event
registration

ServiceWorkerRegistration | undefined

swUrl

string

Returns

void


onRegisterError()?

optional onRegisterError: (error) => void

Something went wrong during the SW registration.

Parameters

error

any

Returns

void