Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created May 11, 2018 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/a0d05952049608da69032e84bd7fbfee to your computer and use it in GitHub Desktop.
Save goofmint/a0d05952049608da69032e84bd7fbfee to your computer and use it in GitHub Desktop.
const transaction = db.transaction(["items"], "readwrite");
transaction.oncomplete = function(event) {
console.log("完了しました");
};
transaction.onerror = function(event) {
console.log("エラーです", event);
};
const objItem = transaction.objectStore("items");
for (let i = 1; i < 10; i += 1) {
objItem.add(
{id: i, name: `テスト商品 ${i}`, description: `テスト商品 ${i} の説明`, add: '追加'}
).onsuccess = function (event) {
console.log(event.target.result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment