mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 11:28:38 +00:00
Bug 920337 - Use promise to ensure we don't miss project load. r=paul
This commit is contained in:
parent
cb3bc8b1f5
commit
76bedf1e68
@ -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",
|
||||
|
@ -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);
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user