files/en-us/web/api/windowsharedstorage/run/index.md
{{APIRef("Shared Storage API")}}{{deprecated_header}}
The run() method of the
{{domxref("WindowSharedStorage")}} interface executes a run operation that is registered in a module added to the current origin's {{domxref("SharedStorageWorklet")}}.
[!NOTE] The Run output gate is intended as a generic way to process some shared storage data.
run(name)
run(name, options)
name
options {{optional_inline}}
data {{optional_inline}}
keepAlive {{optional_inline}}
true, the {{domxref("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 {{domxref("SharedStorageWorkletGlobalScope")}} is terminated after the operation is run and cannot be run again.A {{jsxref("Promise")}} that fulfills with undefined.
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.
{{Specifications}}
{{Compat}}