use_service_worker
Reactive ServiceWorker API.
Please check the working example.
Usage
use leptos::*;
use leptos_use::{use_service_worker_with_options, UseServiceWorkerOptions, UseServiceWorkerReturn};
#[component]
fn Demo() -> impl IntoView {
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"),
);
view! { }
}
Server-Side Rendering
This function does not support SSR. Call it inside a create_effect
.
Feature
This function is only available if the crate feature
use_service_worker
is enabled