Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. IDBDatabase
  4. objectStoreNames

IDBDatabase: objectStoreNames property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

Note: This feature is available inWeb Workers.

TheobjectStoreNames read-only property of theIDBDatabase interface is aDOMStringList containing alist of the names of theobject stores currently in the connected database.

Value

ADOMStringList containing a list ofthe names of theobject stores currentlyin the connected database.

Examples

js
// Let us open our databaseconst DBOpenRequest = window.indexedDB.open("toDoList", 4);// these two event handlers act on the database being opened successfully, or notDBOpenRequest.onerror = (event) => {  note.appendChild(document.createElement("li")).textContent =    "Error loading database.";};DBOpenRequest.onsuccess = (event) => {  note.appendChild(document.createElement("li")).textContent =    "Database initialized.";  // 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 names of the object stores of the connected database, which should be  // an object that looks like { ['my-store-name'] }  console.log(db.objectStoreNames);};

Specifications

Specification
Indexed Database API 3.0
# ref-for-dom-idbdatabase-objectstorenames①

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp