pub struct IdbFrozenStateStore { /* private fields */ }
Expand description

A frozen state store that uses IndexedDB as a backend. This will only store a single frozen state at a time, removing all previously stored states every time a new one is set.

TODO Browser compatibility information.

Implementations

Creates a new store for this origin. If it already exists from a previous visit, the existing one will be interfaced with.

Gets the stored frozen state. Be warned that the result of this could be arbitrarily old, or it may have been tampered with by the user (in which case Perseus will either return an error that you can handle or it’ll fall back to the active state). If no state has been stored yet, this will return Ok(None).

Sets the content to a new frozen state.

Clears the stored frozen state entirely and irrecoverably.

Checks if the storage is persistently stored. If it is, the browser isn’t allowed to clear it, the user would have to manually. This doesn’t provide a guarantee that all users who’ve been to your site before will have previous state stored, you should assume that they could well have cleared it manually (or with very stringent privacy settings).

If this returns an error, a recommendation about whether or not to retry will be attached. You generally shouldn’t retry this more than once if there was an error.

For more information about persistent storage on the web, see here.

Requests persistent storage from the browser. In Firefox, the user will be prompted, though in Chrome the browser will automatically accept or deny based on your site’s level of engagement, whether ot not it’s been installed or bookmarked, and whether or not it’s been granted the permission to show notifications. In other words, do NOT assume that this will be accepted, even if you ask the user very nicely. That said, especially in Firefox, you should display a custom notification before this with alert() or similar that explains why your site needs persistent storage for frozen state.

If this returns false, the request was rejected, but you can retry in future (for user experience though, it’s recommended to only do so very sparingly). If this returns an error, a recommendation about whether or not to retry will be attached. You generally shouldn’t retry this more than once if there was an error.

For more information about persistent storage on the web, see here.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.