IDBDatabase
インターフェイスのclose()は、
ただちに戻り、別スレッドで接続を閉じます。
実際には、この接続を使用していて生成されたすべてのトランザクションが完了するまで、接続は閉じられません。一度このメソッドが呼び出されたら、この接続では、新しいトランザクションを生成することはできません。終了処理がペンディングされている場合は、トランザクションを生成するメソッドは、例外を発生させます。
構文
db.close();
戻り値
Void。
例
// Let us open our database
var DBOpenRequest = window.indexedDB.open("toDoList", 4);
// these two event handlers act on the database being opened successfully, or not
DBOpenRequest.onerror = function(event) {
note.innerHTML += '<li>Error loading database.</li>';
};
DBOpenRequest.onsuccess = function(event) {
note.innerHTML += '<li>Database initialised.</li>';
// store the result of opening the database in the db variable.
db = DBOpenRequest.result;
// now let's close the database again!
db.close();
}
仕様
Specification | Status | Comment |
---|---|---|
Indexed Database API 2.0 close() の定義 |
勧告 |
ブラウザ実装状況
現在、互換性データを可読形式の JSON フォーマットに置き換えているところです。
この互換性一覧は古い形式を使っており、これに含まれるデータの置き換えが済んでいません。
手助けしていただける場合は、こちらから!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 23webkit 24 |
10 moz 16.0 (16.0) |
10, partial | 15 | 7.1 |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.4 | 22.0 (22.0) | 1.0.1 | 10 | 22 | 未対応 |
関連項目
- Using IndexedDB
- Starting transactions:
IDBDatabase
- Using transactions:
IDBTransaction
- Setting a range of keys:
IDBKeyRange
- Retrieving and making changes to your data:
IDBObjectStore
- Using cursors:
IDBCursor
- Reference example: To-do Notifications (view example live.)