IDBVersionChangeEvent()
Draft: This page is not complete.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
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.onupgradeneeded
event handler.
Syntax
var idbVersionChangeEvent = new IDBVersionChangeEvent();
Parameters
type
-
A
DOMString
indicating the event which occurred. ForIDBVersionChangeEvent
this isversionchange
. eventInitDict
-
An optional dictionary of initial values for the event's properties. These are as follows:
-
oldVersion
: An unsigned long representing the previous version of the database. Default is0
. -
newVersion
: An unsigned long representing the new version of the database, ornull
if the database is being deleted. Default isnull
.
-
Examples
For a full working example, see our To-do Notifications app (view example live.)
Specifications
Specification |
---|
Indexed Database API 3.0 (Indexed DB 3.0) # dom-idbversionchangeevent-idbversionchangeevent |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
IDBVersionChangeEvent |
41 |
79 |
25 |
No |
28 |
10 |
41 |
41 |
25 |
28 |
10 |
4.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/IDBVersionChangeEvent/IDBVersionChangeEvent