StorageEvent
{{APIRef("Web Storage API")}}
The StorageEvent
interface is implemented by the {{domxref("Window/storage_event", "storage")}}
event, which is
sent to a window
when a storage area the window has access to is changed within the context of another document.
{{InheritanceDiagram}}
Constructor
{{domxref("StorageEvent.StorageEvent()", "StorageEvent()")}}
- : Returns a newly constructed
StorageEvent
object.
- : Returns a newly constructed
Instance properties
In addition to the properties listed below, this interface inherits the properties of its parent interface, {{domxref("Event")}}
.
{{domxref("StorageEvent.key", "key")}}
{{ReadOnlyInline}}
- : Returns a string with the key for the storage item that was changed.
The
key
attribute isnull
when the change is caused by the storageclear()
method.
- : Returns a string with the key for the storage item that was changed.
The
{{domxref("StorageEvent.newValue", "newValue")}}
{{ReadOnlyInline}}
- : Returns a string with the new value of the storage item that was changed.
This value is
null
when the change has been invoked by storageclear()
method, or the storage item has been removed from the storage.
- : Returns a string with the new value of the storage item that was changed.
This value is
{{domxref("StorageEvent.oldValue", "oldValue")}}
{{ReadOnlyInline}}
- : Returns a string with the original value of the storage item that was changed.
This value is
null
when the storage item has been newly added and therefore doesn’t have any previous value.
- : Returns a string with the original value of the storage item that was changed.
This value is
{{domxref("StorageEvent.storageArea", "storageArea")}}
{{ReadOnlyInline}}
- : Returns a
{{DOMxRef("Storage")}}
object that represents the storage object that was affected.
- : Returns a
{{domxref("StorageEvent.url", "url")}}
{{ReadOnlyInline}}
- : Returns string with the URL of the document whose storage changed.
Instance methods
In addition to the methods listed below, this interface inherits the methods of its parent interface, {{domxref("Event")}}
.
{{domxref("StorageEvent.initStorageEvent", "initStorageEvent()")}}
{{deprecated_inline}}
- : Initializes the event in a manner analogous to the similarly-named
{{domxref("Event.initEvent", "initEvent()")}}
method in the DOM Events interfaces. Use the constructor instead.
- : Initializes the event in a manner analogous to the similarly-named
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
{{domxref("Web Storage API", "", "", "nocode")}}