goog.db
Functions
deleteDatabase( name, opt_onBlocked ) → goog.async.Deferred
goog.async.Deferred
Deletes a database once all open connections have been closed.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
openDatabase( name, opt_version, opt_onUpgradeNeeded, opt_onBlocked ) → goog.async.Deferred
goog.async.Deferred
Opens a database connection and wraps it.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Properties
BlockedCallback → function(goog.db.IndexedDb.VersionChangeEvent): ?
function(goog.db.IndexedDb.VersionChangeEvent): ?
A callback that's called if a blocked event is received. When a database is
supposed to be deleted or upgraded (i.e. versionchange), and there are open
connections to this database, a block event will be fired to prevent the
operations from going through until all such open connections are closed.
This callback can be used to notify users that they should close other tabs
that have open connections, or to close the connections manually. Databases
can also listen for the goog.db.IndexedDb.EventType.VERSION_CHANGE
event to automatically close themselves when they're blocking such
operations.
This is passed a VersionChangeEvent that has the version of the database before it was deleted, and "null" as the new version.
UpgradeNeededCallback → function(goog.db.IndexedDb.VersionChangeEvent, goog.db.IndexedDb, goog.db.Transaction): ?
function(goog.db.IndexedDb.VersionChangeEvent, goog.db.IndexedDb, goog.db.Transaction): ?
A callback that's called when opening a database whose internal version is
lower than the version passed to goog.db.openDatabase
.
This callback is passed three arguments: a VersionChangeEvent with both the old version and the new version of the database; the database that's being opened, for which you can create and delete object stores; and the version change transaction, with which you can abort the version change.
Note that the transaction is not active, which means that it can't be used to
make changes to the database. However, since there is a transaction running,
you can't create another one via goog.db.IndexedDb.createTransaction
.
This means that it's not possible to manipulate the database other than
creating or removing object stores in this callback.