refactor(store)!: remove pinia
* replace pinia with a reactive state object and inject/provide Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> update(store)!: inject store if possible, otherwise create a new one by id Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import useStore from './useStore'
|
||||
import useHooks from './useHooks'
|
||||
import { EmitFunc, FlowOptions, FlowStore } from '~/types'
|
||||
import { EmitFunc, ReactiveFlowStore } from '~/types'
|
||||
|
||||
export const initFlow = (emit: EmitFunc, key?: string, store = useStore(undefined, key)) => {
|
||||
let key = 0
|
||||
export const initFlow = (emit: EmitFunc, id = `vue-flow-${key++}`): ReactiveFlowStore => {
|
||||
const store = useStore({ id })
|
||||
useHooks(store, emit)
|
||||
return store
|
||||
}
|
||||
|
||||
export default (options?: Partial<FlowOptions>): FlowStore => useStore(options)
|
||||
export default useStore
|
||||
|
||||
Reference in New Issue
Block a user