IDBVersionChangeEvent: IDBVersionChangeEvent() constructor
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
TheIDBVersionChangeEvent() constructorcreates a newIDBVersionChangeEvent object, which is used to representwhen a version of the database has changed, as a result of theonupgradeneeded event handler.
In this article
Syntax
new IDBVersionChangeEvent(type)new IDBVersionChangeEvent(type, options)Parameters
typeA string with the name of the event.It is case-sensitive and browsers set it to
versionchange,success, orblocked.optionsOptionalAn object that,in addition of the properties defined in
Event(), can have the following properties:oldVersionOptionalA number representing the previous version of the database. It defaults to
0.newVersionOptionalAn unsigned long representing the new version of the database,or
nullif the database is being deleted. It defaults isnull.
Return value
A newIDBVersionChangeEvent object.
Examples
For a full working example, see ourTo-do Notifications app (view example live).
Specifications
| Specification |
|---|
| Indexed Database API 3.0> # dom-idbversionchangeevent-idbversionchangeevent> |