onclose
event handler of the
IDBDatabase
interface handles the
close
event, which is fired when the database is unexpectedly closed. This can happen, for example, when the application is shut down or access to the disk the database is stored on is lost while the database is open.
close
event is fired after all transactions have been aborted and the connection has been closed.
IDBDatabase.onclose = function(event) { ... };
A function which is called when the
close
event is fired.
db.onclose = function(event) {
myAppShowAlert('The database "' + db.name + '" has unexpectedly closed.');
};
| 规范 | 状态 | 注释 |
|---|---|---|
|
索引数据库 API 草案
The definition of 'onclose' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
onclose
|
Chrome
31
注意事项
|
Edge ≤18 | Firefox 50 | IE ? | Opera Yes | Safari 10.1 | WebView Android Yes | Chrome Android 31 | Firefox Android 50 | Opera Android Yes | Safari iOS 10.3 | Samsung Internet Android 2.0 |
完整支持
兼容性未知
见实现注意事项。
IDBDatabase
IDBDatabase
IDBCursor
IDBCursorSync
IDBCursorWithValue
IDBDatabaseException
IDBDatabaseSync
IDBEnvironment
IDBEnvironmentSync
IDBFactory
IDBFactorySync
IDBIndex
IDBIndexSync
IDBKeyRange
IDBObjectStore
IDBObjectStoreSync
IDBOpenDBRequest
IDBRequest
IDBTransaction
IDBTransactionSync
IDBVersionChangeEvent
IDBVersionChangeRequest