update!: Remove hooks context
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -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,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')
|
||||
|
||||
Reference in New Issue
Block a user