synchronous events, updating title works fully

This commit is contained in:
zadam
2020-01-19 20:18:02 +01:00
parent bd8e5f255b
commit 1098d75ce0
8 changed files with 112 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ export default class Component {
this.initialized = Promise.resolve();
}
async eventReceived(name, data) {
async eventReceived(name, data, sync = false) {
await this.initialized;
// console.log(`Received ${name} to ${this.componentId}`);
@@ -23,12 +23,16 @@ export default class Component {
if (propagateToChildren) {
for (const child of this.children) {
child.eventReceived(name, data);
let promise = child.eventReceived(name, data, sync);
if (sync) {
await promise;
}
}
}
}
trigger(name, data) {
this.appContext.trigger(name, data);
trigger(name, data, sync = false) {
this.appContext.trigger(name, data, sync);
}
}