refactor(core): use useOnInitHandler to emit paneReady event

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 9e72e725e8
commit 5798cc5578
6 changed files with 136 additions and 133 deletions
@@ -0,0 +1,14 @@
import { watch } from 'vue'
import { useVueFlow } from './useVueFlow'
export function useOnInitHandler() {
const vfInstance = useVueFlow()
watch(vfInstance.viewportInitialized, (isInitialized) => {
if (isInitialized) {
setTimeout(() => {
vfInstance.emits.paneReady(vfInstance)
}, 1)
}
})
}