Browse Source

feat(gui-v2): accept keyname as arg for useInjectionState

pull/2943/head
braks 2 years ago
parent
commit
4f463c6365
  1. 3
      packages/nc-gui-v2/composables/useInjectionState/index.ts

3
packages/nc-gui-v2/composables/useInjectionState/index.ts

@ -2,8 +2,9 @@ import type { InjectionKey } from 'vue'
export function useInjectionState<Arguments extends any[], Return>(
composable: (...args: Arguments) => Return,
keyName = 'InjectionState',
): readonly [useProvidingState: (...args: Arguments) => void, useInjectedState: () => Return | undefined] {
const key: string | InjectionKey<Return> = Symbol('InjectionState')
const key: string | InjectionKey<Return> = Symbol(keyName)
const useProvidingState = (...args: Arguments) => {
const providedState = composable(...args)

Loading…
Cancel
Save