当存储区域(localStorage 或 sessionStorage)被修改时,将触发 storage 事件。查看 Web Storage API 来获取更多信息。
常规信息
- Specification
- Web Storage
- Interface
StorageEvent
- Bubbles
- No
- Cancelable
- No
- Target
- DefaultView (
<window>
) - Default Action
- None
属性
Property | Type | Description |
---|---|---|
target 只读 |
EventTarget |
The event target (the topmost target in the DOM tree). |
type 只读 |
DOMString |
The type of event. |
bubbles 只读 |
Boolean |
Whether the event normally bubbles or not |
cancelable 只读 |
Boolean |
Whether the event is cancellable or not? |
key 只读 |
DOMString (string) | The key being changed. |
oldValue 只读 |
DOMString (string) | The old value of the key being changed. |
newValue 只读 |
DOMString (string) | The new value of the key being changed. |
url 只读 |
DOMString (string) | The address of the document whose key changed. |
storageArea 只读 |
Storage | The Storage object that was affected. |