pub struct ServiceWorker { /* private fields */ }Expand description
An application’s service-worker setting. See the module docs.
Implementations§
Source§impl ServiceWorker
impl ServiceWorker
Sourcepub fn off() -> Self
pub fn off() -> Self
The default: no page registers a worker, and /sw.js is the retiring
worker for v1’s cache names.
Sourcepub fn for_app(app: &str) -> Result<Self, AppNameError>
pub fn for_app(app: &str) -> Result<Self, AppNameError>
Name the application, still off: /sw.js is the retiring worker,
which also deletes this application’s own caches (forma:<app>:...).
Add ServiceWorker::enabled to turn the worker on.
§Errors
An AppNameError unless app is 1 to 63 of a-z, 0-9 and -,
starting with a letter or digit.
Sourcepub fn enabled(self) -> Self
pub fn enabled(self) -> Self
Turn the worker on: every page registers /sw.js, and /sw.js
serves the worker the build embedded.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether pages register the worker.
Trait Implementations§
Source§impl Clone for ServiceWorker
impl Clone for ServiceWorker
Source§impl Debug for ServiceWorker
impl Debug for ServiceWorker
Source§impl Default for ServiceWorker
impl Default for ServiceWorker
impl Eq for ServiceWorker
Source§impl PartialEq for ServiceWorker
impl PartialEq for ServiceWorker
impl StructuralPartialEq for ServiceWorker
Auto Trait Implementations§
impl Freeze for ServiceWorker
impl RefUnwindSafe for ServiceWorker
impl Send for ServiceWorker
impl Sync for ServiceWorker
impl Unpin for ServiceWorker
impl UnsafeUnpin for ServiceWorker
impl UnwindSafe for ServiceWorker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more