WorkletSharedStorage: keys()-Methode
Deprecated
Avoid using this feature in new projects. This feature may be a candidate for removal from web standards or browsers.>
Die keys()-Methode des WorkletSharedStorage-Interfaces gibt einen asynchronen Iterator zurück, der die Schlüssel für jedes Element in einer WorkletSharedStorage-Instanz enthält.
Syntax
js
keys()
Parameter
Keine.
Rückgabewert
Ein Array der aufzählbaren Eigenschaftsschlüssel des WorkletSharedStorage.
Ausnahmen
TypeError-
Wird ausgelöst, wenn die aufrufende Stelle die Shared Storage API nicht in einem erfolgreichen Privacy Sandbox-Einschreibungsprozess enthalten hat.
Beispiele
js
// keys() available inside a shared storage worklet module
const storage = await this.sharedStorage;
async function logKeys() {
for await (const key of storage.keys()) {
console.log(key);
}
}