SharedStorageWorkletGlobalScope: sharedStorage property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
Thecontext read-only property of theSharedStorageWorkletGlobalScope interface contains aWorkletSharedStorage object instance, which represents the shared storage for a particular origin as exposed to a worklet context.
In this article
Value
AWorkletSharedStorage object instance.
Examples
js
// ab-testing-worklet.jsclass SelectURLOperation { async run(urls, data) { // Read the user's experiment group from shared storage const experimentGroup = await this.sharedStorage.get("ab-testing-group"); // Return the group number return experimentGroup; }}register("ab-testing", SelectURLOperation);Specifications
| Specification |
|---|
| Shared Storage API> # dom-sharedstorageworkletglobalscope-sharedstorage> |