leptos_use

Function use_service_worker

Source
pub fn use_service_worker() -> UseServiceWorkerReturn<impl Fn() + Clone, impl Fn() + Clone>
Expand description

Reactive ServiceWorker API.

Please check the working example.

§Usage

let UseServiceWorkerReturn {
        registration,
        installing,
        waiting,
        active,
        skip_waiting,
        check_for_update,
} = use_service_worker_with_options(UseServiceWorkerOptions::default()
    .script_url("service-worker.js")
    .skip_waiting_message("skipWaiting"),
);

§Server-Side Rendering

This function does not support SSR. Call it inside a create_effect.