Add onCreate in customElementConfig

This commit is contained in:
ad1992 2022-04-19 21:58:38 +05:30
parent 4e75f10b2c
commit ba48aa24a0
4 changed files with 48 additions and 28 deletions

View file

@ -452,6 +452,16 @@ class App extends React.Component<AppProps, AppState> {
width,
height,
});
this.scene.addCallback(() => {
const customElementConfig = getCustomElementConfig(
this.props.customElementsConfig,
customElement.customType,
);
if (customElementConfig && customElementConfig.onCreate) {
customElementConfig.onCreate(customElement);
}
});
this.scene.replaceAllElements([
...this.scene.getElementsIncludingDeleted(),
customElement,