Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
sync fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Oct 9, 2017
1 parent 33fb4c6 commit e75ff47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions localassetmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

function getServerItems(serverId) {

console.log('[localassetmanager] Begin getServerItems');

return itemrepository.getAll(serverId);
}

Expand Down
9 changes: 7 additions & 2 deletions sync/itemrepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

function ServerDatabase(dbName, readyCallback) {

var instance = this;
var request = indexedDB.open(dbName, dbVersion);

request.onerror = function (event) {
Expand All @@ -34,9 +33,14 @@
// Use transaction oncomplete to make sure the objectStore creation is
// finished before adding data into it.
objectStore.transaction.oncomplete = function (event) {
readyCallback(instance);
readyCallback(db);
};
};

request.onsuccess = function (event) {
var db = event.target.result;
readyCallback(db);
};
}

function getDbName(serverId) {
Expand All @@ -50,6 +54,7 @@
var db = databases[dbName];
if (db) {
callback(db);
return;
}

new ServerDatabase(dbName, function (db) {
Expand Down

0 comments on commit e75ff47

Please sign in to comment.