diff --git a/packages/troika-core/src/facade/Facade.js b/packages/troika-core/src/facade/Facade.js index 49ac9143..72415c94 100644 --- a/packages/troika-core/src/facade/Facade.js +++ b/packages/troika-core/src/facade/Facade.js @@ -65,6 +65,21 @@ export default class Facade { this.parent = parent } + /** + * Performs a manual update of this facade, invoking the afterUpdate lifecycle method and triggering a + * render. This can be called in event handlers, for example, to affect changes to this facade and its + * subtree. This process is synchronous. Never override this method as a way to react to updates, as it + * is not the only way a component is updated; instead override `afterUpdate` or use setters. + * @param {object} props - A set of properties to be copied to the facade + */ + update(props) { + if (props && typeof props === 'object') { + assign(this, props) + this.afterUpdate() + this.notifyWorld('needsRender') + } + } + /** * Called at the end of an update batch, after all individual properties have been assigned. */