Refactor svg-layout-designer component into controllers + Add setLoaded

This commit is contained in:
Eric NGUYEN 2022-09-23 15:22:07 +02:00
parent 2ea43890f0
commit 8ba19cc96b
3 changed files with 140 additions and 87 deletions

View file

@ -44,7 +44,8 @@ function UseHTTPGETStatePreloading(
function UseCustomEvents(
root: Element | Document,
appRef: React.RefObject<HTMLDivElement>,
setEditor: (newState: IEditorState) => void
setEditor: (newState: IEditorState) => void,
setLoaded: (loaded: boolean) => void
): void {
useEffect(() => {
const funcs = new Map<string, () => void>();
@ -53,6 +54,7 @@ function UseCustomEvents(
return event.func(
root,
setEditor,
setLoaded,
eventInitDict
);
}
@ -96,7 +98,8 @@ export function App(props: IAppProps): JSX.Element {
UseCustomEvents(
props.root,
appRef,
setEditorState
setEditorState,
setLoaded
);
UseHTTPGETStatePreloading(isLoaded, setEditorState, setLoaded);