Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The length() method of the WorkletSharedStorage interface returns the number of entries currently stored in shared storage for the current origin.
length()
None.
A Promise that fulfills with a number, which represents the total count of key-value pairs currently in the shared storage.
TypeErrorThrown if:
addModule().// length() available inside a shared storage worklet module
async function retrieveLength() {
const length = await this.sharedStorage.length();
console.log(length);
}
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WorkletSharedStorage/length