update(types): Remove unnecessary type exports
* rename StringFunc for better understanding
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { EmitFunc, FlowHooks, FlowEvents } from '~/types'
|
||||
import { EmitFunc, FlowHooks } from '~/types'
|
||||
|
||||
// flow event hooks
|
||||
export const createHooks = (): FlowHooks => ({
|
||||
@@ -41,7 +41,7 @@ export const createHooks = (): FlowHooks => ({
|
||||
|
||||
const bind = (emit: EmitFunc, hooks: FlowHooks) => {
|
||||
for (const [key, value] of Object.entries(hooks)) {
|
||||
value.on((data: FlowEvents[keyof FlowHooks]) => {
|
||||
value.on((data) => {
|
||||
emit(key as keyof FlowHooks, data)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import useState from './state'
|
||||
import useActions from './actions'
|
||||
import useGetters from './getters'
|
||||
import { FlowHook, FlowHooksOn, FlowOptions, Store, State } from '~/types'
|
||||
import { FlowHooksOn, FlowOptions, Store, State } from '~/types'
|
||||
|
||||
export default (preloadedState?: FlowOptions): Store => {
|
||||
const state: State = useState(preloadedState)
|
||||
@@ -10,8 +10,8 @@ export default (preloadedState?: FlowOptions): Store => {
|
||||
const actions = useActions(reactiveState, getters)
|
||||
const hooksOn: FlowHooksOn = <any>{}
|
||||
Object.entries(reactiveState.hooks).forEach(([n, h]) => {
|
||||
const name = `on${n.charAt(0).toUpperCase() + n.slice(1)}`
|
||||
hooksOn[<keyof FlowHooksOn>name] = h.on as FlowHook['on']
|
||||
const name = `on${n.charAt(0).toUpperCase() + n.slice(1)}` as keyof FlowHooksOn
|
||||
hooksOn[name] = h.on as any
|
||||
})
|
||||
actions.setState(reactiveState)
|
||||
if (preloadedState) {
|
||||
@@ -21,7 +21,6 @@ export default (preloadedState?: FlowOptions): Store => {
|
||||
}
|
||||
|
||||
return reactive({
|
||||
state: reactiveState,
|
||||
...hooksOn,
|
||||
...toRefs(reactiveState),
|
||||
...getters,
|
||||
|
||||
Reference in New Issue
Block a user