IndexedDB
The IDBVersionChangeEvent() constructor
creates a new IDBVersionChangeEvent object, which is used to represent
when a version of the database has changed, as a result of the
IDBOpenDBRequest.upgradeneeded_event event handler.
Syntax
new IDBVersionChangeEvent(type)
new IDBVersionChangeEvent(type, options)
Parameters
type- : A string with the name of the event.
It is case-sensitive and browsers set it to
versionchange,success, orblocked.
- : A string with the name of the event.
It is case-sensitive and browsers set it to
options- : An object that, in addition of the properties defined in Event/Event, can have the following properties:
oldVersion- : A number representing the previous version of the database. It defaults to
0.
- : A number representing the previous version of the database. It defaults to
newVersion- : An unsigned long representing the new version of the database,
or
nullif the database is being deleted. It defaults isnull.
- : An unsigned long representing the new version of the database,
or
- : An object that, in addition of the properties defined in Event/Event, can have the following properties:
Return value
A new IDBVersionChangeEvent object.
Examples
For a full working example, see our To-do Notifications app (view example live).
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
