update: remove useHooks usage

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-18 23:17:09 +01:00
parent 99dbd4b2cc
commit 470ab3782a
16 changed files with 97 additions and 81 deletions
+2 -3
View File
@@ -1,4 +1,3 @@
import useStore from './useStore'
import {
Connection,
Edge,
@@ -10,6 +9,7 @@ import {
OnConnectStartParams,
FlowInstance,
FlowEvents,
FlowStore,
} from '~/types'
import { Hooks } from '~/context'
@@ -66,10 +66,9 @@ const bind = (emit: EmitFunc, hooks: FlowHooks) => {
}
}
export default (emit?: EmitFunc) => {
export default (store: FlowStore, emit?: EmitFunc) => {
let hooks = inject(Hooks)!
if (!hooks) {
const store = useStore()
if (import.meta.env.DEV) console.warn('hooks context not found; creating default hooks')
hooks = store.hooks
if (typeof emit === 'function') bind(emit, hooks)