ClientStorage
Browser storage for plugin data that persists across sessions.
ClientStorage interface
Browser storage for plugin data that persists across sessions.
Signature:
interface ClientStorageRemarks
Client storage allows you to store data on the user's browser. Unlike PluginData, data stored here is not saved with the animation file - it's local to the user's browser only.
Store values like booleans, numbers, strings, dates, objects, arrays, regexps, undefined, or null.
The total amount of data you can save per plugin is limited to 5 MB.
This data is specific to your plugin ID. It will be inaccessible if your plugin ID changes.
Other plugins cannot access this data. However, you should avoid storing sensitive data here. It is possible for users to inspect this data through browser developer tools.
As this data is stored on the user's browser, it might be cleared if the user clears their browser data.
Example
Store and retrieve user preferences:
await creator.clientStorage.set("theme", "dark");
// Retrieve preferences
const theme = await creator.clientStorage.get("theme"); // "dark"Methods
Method | Description |
|---|---|
Clears all client storage data for this plugin. | |
Deletes a value from client storage. | |
Retrieves a value from client storage. | |
Gets all storage keys for this plugin. | |
Stores a value in client storage. | |
Gets the current data quota usage (in bytes) for this plugin. |