mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920337 - Use promise to ensure we don't miss project load. r=paul
This commit is contained in:
parent
a2f5d7482a
commit
76822a147d
@ -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