change hook didDomUpdate name

This commit is contained in:
Bowen Tan 2022-03-02 10:09:43 +08:00
parent 405a46dcef
commit ba25194287
3 changed files with 5 additions and 5 deletions

View File

@ -50,11 +50,11 @@ export function initSunmaoUIEditor(props: SunmaoUIEditorProps = {}) {
const didUpdate = () => {
eventBus.send('HTMLElementsUpdated');
};
const didHtmlUpdate = () => {
const didDomUpdate = () => {
eventBus.send('HTMLElementsUpdated');
};
const ui = initSunmaoUI({ ...props.runtimeProps, hooks: { didMount, didUpdate, didHtmlUpdate } });
const ui = initSunmaoUI({ ...props.runtimeProps, hooks: { didMount, didUpdate, didDomUpdate } });
const App = ui.App;
const registry = ui.registry;

View File

@ -20,7 +20,7 @@ const _ImplWrapper = React.forwardRef<HTMLDivElement, ImplWrapperProps>((props,
const eleRef = useRef<HTMLElement>();
const onRef = (ele: HTMLElement) => {
eleMap.set(c.id, ele);
hooks?.didHtmlUpdate && hooks?.didHtmlUpdate();
hooks?.didDomUpdate && hooks?.didDomUpdate();
};
useEffect(() => {

View File

@ -35,6 +35,6 @@ export type AppHooks = {
didMount?: () => void;
// app updates after schema changes
didUpdate?: () => void;
// app updates after html elements change
didHtmlUpdate?: () => void;
// app updates after dom change(dose not include updates from schema change)
didDomUpdate?: () => void;
};