feat: Add useVueFlow composable

* Allows for use of the vue flow instance without having to listen to the onLoad event
* fix usekeypress export
* Add types for controls events

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-18 18:04:50 +01:00
parent e98be05d41
commit a493168daf
4 changed files with 34 additions and 5 deletions
+22
View File
@@ -0,0 +1,22 @@
import useHooks from './useHooks'
import useStore from './useStore'
import { FlowInstance } from '~/types'
export default () => {
const store = useStore()
const hooks = useHooks()
const isReady = ref(false)
const instance = ref<FlowInstance>()
hooks.load.on((flow) => {
isReady.value = true
instance.value = flow
if (import.meta.env.DEV) console.log(`vue flow ${store.$id} ready.`)
})
return {
isReady,
instance,
store,
hooks,
}
}