feat: merge store with props
* if options are passed to useVueFlow, we want to merge them with possibly passed props * renamed flowStore to stateStore * fix examples * add store prop to pass an already existing store to flow Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
import useHooks from './useHooks'
|
||||
import useStore from './useStore'
|
||||
import useHooks from './useHooks'
|
||||
import { EmitFunc, FlowOptions, FlowStore } from '~/types'
|
||||
|
||||
export const initFlow = (emit: EmitFunc, options: Partial<FlowOptions>) => {
|
||||
const store = useStore(options)
|
||||
const hooks = useHooks(store, emit)
|
||||
|
||||
return {
|
||||
store,
|
||||
hooks,
|
||||
}
|
||||
export const initFlow = (emit: EmitFunc, store = useStore()) => {
|
||||
useHooks(store, emit)
|
||||
return store
|
||||
}
|
||||
|
||||
export default (options?: Partial<FlowOptions>): FlowStore => useStore(options)
|
||||
|
||||
Reference in New Issue
Block a user