Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

OpenDBCallbacks

interface OpenDBCallbacks <DBTypes extends DBSchema | unknown> {
blocked?(
currentVersion: number,
blockedVersion: number | null,
event: IDBVersionChangeEvent,
): void;
blocking?(
currentVersion: number,
blockedVersion: number | null,
event: IDBVersionChangeEvent,
): void;
terminated?(): void;
upgrade?(
database: IDBPDatabase<DBTypes>,
oldVersion: number,
newVersion: number | null,
transaction: IDBPTransaction<DBTypes, StoreNames<DBTypes>[], "versionchange">,
event: IDBVersionChangeEvent,
): void;
}

§Type Parameters

§
DBTypes extends DBSchema | unknown
[src]

§Methods

§
blocked?(
currentVersion: number,
blockedVersion: number | null,
event: IDBVersionChangeEvent,
): void
[src]

Called if there are older versions of the database open on the origin, so this version cannot open.

@param currentVersion

Version of the database that's blocking this one.

@param blockedVersion

The version of the database being blocked (whatever version you provided to openDB).

@param event

The event object for the associated blocked event.

§
blocking?(
currentVersion: number,
blockedVersion: number | null,
event: IDBVersionChangeEvent,
): void
[src]

Called if this connection is blocking a future version of the database from opening.

@param currentVersion

Version of the open database (whatever version you provided to openDB).

@param blockedVersion

The version of the database that's being blocked.

@param event

The event object for the associated versionchange event.

§
terminated?(): void
[src]

Called if the browser abnormally terminates the connection. This is not called when db.close() is called.

§
upgrade?(
database: IDBPDatabase<DBTypes>,
oldVersion: number,
newVersion: number | null,
transaction: IDBPTransaction<DBTypes, StoreNames<DBTypes>[], "versionchange">,
event: IDBVersionChangeEvent,
): void
[src]

Called if this version of the database has never been opened before. Use it to specify the schema for the database.

@param database

A database instance that you can use to add/remove stores and indexes.

@param oldVersion

Last version of the database opened by the user.

@param newVersion

Whatever new version you provided.

@param transaction

The transaction for this upgrade. This is useful if you need to get data from other stores as part of a migration.

@param event

The event object for the associated 'upgradeneeded' event.