[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/API/IDBObjectStore [Back]  [Original]

IDBObjectStore - Web API | MDN

MDN Web Docs

View in English Always switch to English

IDBObjectStore

Baseline *

20157

*

IndexedDB API IDBObjectStore

:

IDBObjectStore.indexNames

IDBObjectStore.keyPath

null

IDBObjectStore.name

IDBObjectStore.transaction

IDBTransaction

IDBObjectStore.autoIncrement

IDBObjectStore.add()

IDBRequest value

IDBObjectStore.clear()

IDBRequest

IDBObjectStore.count()

IDBRequest IDBKeyRange

IDBObjectStore.createIndex()

IDBIndex

IDBObjectStore.delete()

IDBRequest

IDBObjectStore.deleteIndex()

IDBObjectStore.get()

IDBRequest

IDBObjectStore.getKey()

IDBRequest

IDBObjectStore.getAll()

IDBRequest

IDBObjectStore.getAllKeys()

IDBRequest

IDBObjectStore.index()

IDBObjectStore.openCursor()

IDBRequest IDBCursorWithValue

IDBObjectStore.openKeyCursor()

IDBRequest IDBCursor

IDBObjectStore.put()

IDBRequest value readwrite

onupgradeneeded IDBObjectStore.createIndex IDBObjectStore.add To-do Notifications ()

js
// 
const DBOpenRequest = window.indexedDB.open("toDoList", 4);

DBOpenRequest.onsuccess = (event) => {
  note.innerHTML += "<li></li>";

  //  db 
  db = DBOpenRequest.result;
};

// 
//  window.indexedDB.open 
// 
// 
DBOpenRequest.onupgradeneeded = (event) => {
  const db = event.target.result;

  db.onerror = (event) => {
    note.innerHTML +=
      "<li></li>";
  };

  //  objectStore 

  const objectStore = db.createObjectStore("toDoList", {
    keyPath: "taskTitle",
  });

  // objectStore 

  objectStore.createIndex("hours", "hours", { unique: false });
  objectStore.createIndex("minutes", "minutes", { unique: false });
  objectStore.createIndex("day", "day", { unique: false });
  objectStore.createIndex("month", "month", { unique: false });
  objectStore.createIndex("year", "year", { unique: false });

  objectStore.createIndex("notified", "notified", { unique: false });

  note.innerHTML += "<li></li>";
};

// 
const newItem = [
  {
    taskTitle: "Walk dog",
    hours: 19,
    minutes: 30,
    day: 24,
    month: "December",
    year: 2013,
    notified: "no",
  },
];

// 
const transaction = db.transaction(["toDoList"], "readwrite");

// 
transaction.oncomplete = (event) => {
  note.innerHTML += "<li></li>";
};

transaction.onerror = (event) => {
  note.innerHTML +=
    "<li></li>";
};

// 
const objectStore = transaction.objectStore("toDoList");
//  newItem 
const objectStoreRequest = objectStore.add(newItem[0]);

objectStoreRequest.onsuccess = (event) => {
  note.innerHTML += "<li></li>";
};

Indexed Database API 3.0
# object-store-interface


Web Proxy Viewer  |  New URL  |  Original Page