let request = indexedDB.open(name, 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
let event = yield undefined;
let db = event.target.result;
for (let i = 0; i < objectStoreInfo.length; i++) {
let info = objectStoreInfo[i];
let objectStore = info.hasOwnProperty("options")
? db.createObjectStore(info.name, info.options)
: db.createObjectStore(info.name);
// Test index creation, and that it ends up in indexNames. for (let j = 0; j < indexInfo.length; j++) {
let info = indexInfo[j];
info.hasOwnProperty("options")
? objectStore.createIndex(info.name, info.keyPath, info.options)
: objectStore.createIndex(info.name, info.keyPath);
}
}
let objectStoreNames = []; for (let i = 0; i < objectStoreInfo.length; i++) {
let info = objectStoreInfo[i];
objectStoreNames.push(info.name);
is(
db.objectStoreNames[info.location],
info.name, "Got objectStore name in the right location"
);
let trans = db.transaction(info.name);
let objectStore = trans.objectStore(info.name); for (let j = 0; j < indexInfo.length; j++) {
let info = indexInfo[j];
is(
objectStore.indexNames[info.location],
info.name, "Got index name in the right location"
);
}
}
let trans = db.transaction(objectStoreNames); for (let i = 0; i < objectStoreInfo.length; i++) {
let info = objectStoreInfo[i];
is(
trans.objectStoreNames[info.location],
info.name, "Got objectStore name in the right location"
);
}
objectStoreNames = []; for (let i = 0; i < objectStoreInfo.length; i++) {
let info = objectStoreInfo[i];
objectStoreNames.push(info.name);
is(
db.objectStoreNames[info.location],
info.name, "Got objectStore name in the right location"
);
let trans = db.transaction(info.name);
let objectStore = trans.objectStore(info.name); for (let j = 0; j < indexInfo.length; j++) {
let info = indexInfo[j];
is(
objectStore.indexNames[info.location],
info.name, "Got index name in the right location"
);
}
}
trans = db.transaction(objectStoreNames); for (let i = 0; i < objectStoreInfo.length; i++) {
let info = objectStoreInfo[i];
is(
trans.objectStoreNames[info.location],
info.name, "Got objectStore name in the right location"
);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.