postpone update to next microtask

This commit is contained in:
2019-01-25 19:27:11 +01:00
parent c07a74d3a2
commit 43736b0415
15 changed files with 156 additions and 20 deletions

View File

@@ -9,10 +9,22 @@ export default class Node {
this.__in = new Inputs(inputDefinition, this);
this.__out = new Outputs(outputDefiniton, this);
this.__in.update = (name) => this.__update([name]);
this.__scheduledUpdate = false;
}
__update(changes) {
throw new Error('__update method not implemented');
if (!this.__scheduledUpdate) {
this.__scheduledUpdate = true;
Promise.resolve()
.then(() => {
this.__scheduledUpdate = false;
this._update();
});
}
}
_update(){
throw new Error('_update method not implemented');
}
/**