Chrome で使用する indexeddb ストレージをセットアップしようとしています。しかし、トランザクション Uncaught TypeError
を設定しようとするとエラーが発生します。READ_WRITE
webkitIDB の使用に関する適切な最新情報を見つけることができませんでした。だから私は基本的にここで盲目的に飛んでいます。私が間違ったことをしたアイデアはありますか?私が見逃したこれについての良い話はありますか?
設定:
function OfflineStorage() {
this.saveJSONString = __bind(this.saveJSONString, this);
var request,
_this = this;
this.dbkeyRange = window.webkitIDBKeyRange;
this.dbTransaction = window.webkitIDBTransaction;
this.db = window.webkitIndexedDB;
request = this.db.open("lucidFrog");
request.onsuccess = function(e) {
_this.db = e.target.result;
return _this.setupDB(); //setupDB() ensures the objectStores have been created.
};
}
保存機能:
OfflineStorage.prototype.saveJSONString = function(objectStore, json_string, obj_id) {
var request, store, transaction;
//PROBLEM AREA, gives "Uncaught TypeError: Type error"
transaction = this.db.transaction([objectStore], this.dbTransaction.READ_WRITE, 0);
////////////////////
store = transaction.objectStore(objectStore);
request = store.put({
"json": json_string,
"id": obj_id
});
request.onsuccess = function(e) {
return console.log("YYYYYYEEEEEAAAAAHHHHHH!!!");
};
};
要求objectStore
されたが作成され、this.dbTransaction
定義されていることが確認されました。