Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The run() method of the WindowSharedStorage interface executes a run operation that is registered in a module added to the current origin's SharedStorageWorklet.
Note: The Run output gate is intended as a generic way to process some shared storage data.
run(name)
run(name, options)nameA string representing the registered operation's name within the shared storage worklet module. It must match the name given to the operation when it is registered with SharedStorageWorkletGlobalScope.register().
options OptionalAn options object that can contain the following properties:
data OptionalAn object representing any data required for executing the operation.
keepAlive OptionalA boolean value. If set to true, the SharedStorageWorkletGlobalScope of the associated worklet is kept alive, and the operation can be run again. Therefore, you need to set keepAlive to true for each operation that is not intended to be the last one. The default value, false, means that the SharedStorageWorkletGlobalScope is terminated after the operation is run and cannot be run again.
A Promise that fulfills with undefined.
TypeErrorThrown if:
addModule().async function measureUniqueReach() {
// Load the Shared Storage worklet
await window.sharedStorage.worklet.addModule("reach-measurement-worklet.js");
// Run the reach measurement operation
await window.sharedStorage.run("reach-measurement", {
data: { contentId: "1234" },
});
}
measureUniqueReach();See Unique reach measurement for a full explanation of this example. See Shared Storage API for more examples.