IDBDatabase.version
プロパティ は、接続しているデータベースのバージョンを含む64-bit integerです。データベースを初めて生成した時、この属性は空文字です。IDBDatabase
インターフェイスのversion
構文
db.version
値
接続しているデータベースのバージョンを含む整数値。
例
// 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. This is used a lot below
db = DBOpenRequest.result;
// This line will log the version of the connected database, which should be "4"
console.log(db.version);
};
仕様
Specification | Status | Comment |
---|---|---|
Indexed Database API 2.0 version の定義 |
勧告 |
ブラウザ実装状況
BCD tables only load in the browser
関連情報
- Using IndexedDB
- Starting transactions:
IDBDatabase
- Using transactions:
IDBTransaction
- Setting a range of keys:
IDBKeyRange
(en-US) - Retrieving and making changes to your data:
IDBObjectStore
(en-US) - Using cursors:
IDBCursor
- Reference example: To-do Notifications (view example live.)