update!: Remove hooks context

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-19 21:13:03 +01:00
parent 37388ddf47
commit 921d93c73e
2 changed files with 2 additions and 14 deletions
+1 -12
View File
@@ -11,7 +11,6 @@ import {
FlowEvents,
FlowStore,
} from '~/types'
import { Hooks } from '~/context'
// flow event hooks
export const createHooks = (): FlowHooks => {
@@ -66,14 +65,4 @@ const bind = (emit: EmitFunc, hooks: FlowHooks) => {
}
}
export default (store: FlowStore, emit?: EmitFunc) => {
let hooks = inject(Hooks, null)!
if (!hooks) {
if (import.meta.env.DEV) console.warn('hooks context not found; creating default hooks')
hooks = store.hooks
if (typeof emit === 'function') bind(emit, hooks)
provide(Hooks, hooks)
}
return hooks
}
export default (store: FlowStore, emit: EmitFunc) => bind(emit, store.hooks)
+1 -2
View File
@@ -1,6 +1,5 @@
import { InjectionKey } from 'vue'
import { ElementId, FlowHooks, FlowStore } from '~/types'
import { ElementId, FlowStore } from '~/types'
export const Store: InjectionKey<FlowStore> = Symbol('store')
export const Hooks: InjectionKey<FlowHooks> = Symbol('hooks')
export const NodeId: InjectionKey<ElementId> = Symbol('nodeId')