Commit ad6bacda authored by Alexandra Rogova's avatar Alexandra Rogova

added bulk to indexeddb

parent 11370391
......@@ -346,6 +346,30 @@
});
});
};
IndexedDBStorage.prototype.bulk = function (content) {
return waitForOpenIndexedDB(this._database_name, function (db) {
return waitForTransaction(db, ["metadata"], "readwrite",
function (tx) {
var i,
length = content.length,
promise_list = [],
store = tx.objectStore("metadata"),
add_to_queue = function(item){
promise_list.push(
waitForIDBRequest(store.put({
"_id": item.id,
"doc": item.metadata
}))
);
};
for (i=0; i < length; i+=1){
add_to_queue(content[i]);
}
return RSVP.all(promise_list);
});
});
};
IndexedDBStorage.prototype.remove = function (id) {
return waitForOpenIndexedDB(this._database_name, function (db) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment