diff --git a/browser/devtools/app-manager/app-projects.js b/browser/devtools/app-manager/app-projects.js index 32e482d23c09..78349f0ce768 100644 --- a/browser/devtools/app-manager/app-projects.js +++ b/browser/devtools/app-manager/app-projects.js @@ -88,12 +88,19 @@ const IDB = { const store = new ObservableObject({ projects:[] }); +let loadDeferred = promise.defer(); + IDB.open().then(function (projects) { store.object.projects = projects; AppProjects.emit("ready", store.object.projects); + loadDeferred.resolve(); }); const AppProjects = { + load: function() { + return loadDeferred.promise; + }, + addPackaged: function(folder) { let project = { type: "packaged", diff --git a/browser/devtools/app-manager/content/projects.js b/browser/devtools/app-manager/content/projects.js index dbc39342cfe6..ed3ed1a3a40c 100644 --- a/browser/devtools/app-manager/content/projects.js +++ b/browser/devtools/app-manager/content/projects.js @@ -39,10 +39,8 @@ let UI = { this.template = new Template(document.body, AppProjects.store, Utils.l10n); this.template.start(); - AppProjects.store.on("set", (event,path,value) => { - if (path == "projects") { - AppProjects.store.object.projects.forEach(UI.validate); - } + AppProjects.load().then(() => { + AppProjects.store.object.projects.forEach(UI.validate); }); },