From 921d93c73e4a1de210559ea6f8bdc73c4587d3ba Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 19 Nov 2021 21:13:03 +0100 Subject: [PATCH] update!: Remove hooks context Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- src/composables/useHooks.ts | 13 +------------ src/context/index.ts | 3 +-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/composables/useHooks.ts b/src/composables/useHooks.ts index b9e49b07..c4f472ff 100644 --- a/src/composables/useHooks.ts +++ b/src/composables/useHooks.ts @@ -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) diff --git a/src/context/index.ts b/src/context/index.ts index 95df9a46..f115fdbd 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -1,6 +1,5 @@ import { InjectionKey } from 'vue' -import { ElementId, FlowHooks, FlowStore } from '~/types' +import { ElementId, FlowStore } from '~/types' export const Store: InjectionKey = Symbol('store') -export const Hooks: InjectionKey = Symbol('hooks') export const NodeId: InjectionKey = Symbol('nodeId')