Web APIs
StorageEvent.key
Name of the changed storage key, or null for a clear operation. Synthetic construction tests handler data only, not actual delivery across tabs.
Formal Syntax & Structure
javascript syntaxjavascript
event.keyReturn Value
string | null
Changed key or null for clear.
Working Example
Example Snippetjavascript
const e=new StorageEvent("storage",{key:"theme",oldValue:"light",newValue:"dark"});console.log(e.key,e.oldValue,e.newValue);