@rallie/vue
Advanced tools
Comparing version 0.5.2 to 0.6.0
import { UnwrapRef } from 'vue'; | ||
import { App, Connector, State, ReadOnlyState } from 'rallie'; | ||
export declare function stateHook<T extends object>(state: State<T> | ReadOnlyState<T>): <P>(getter: (_state: T) => P) => import("vue").Ref<UnwrapRef<P>>; | ||
import { App, Connector } from 'rallie'; | ||
export declare function stateHook<State extends object>(app: App<State> | Connector<State>): <P>(getter: (_state: State) => P) => import("vue").Ref<UnwrapRef<P>>; | ||
export declare function eventsHook<Events>(app: App | Connector): (events: Partial<Events>) => void; | ||
export declare function methodsHook<Methods>(app: App): (events: Partial<Methods>) => void; |
import { ref, onBeforeUnmount, onBeforeMount } from 'vue'; | ||
// import { effect } from '@rallie/core' | ||
function stateHook(state) { | ||
function stateHook(app) { | ||
return function (getter) { | ||
var stateRef = ref(state.get(getter)); | ||
var unwatch = state.watch(getter).do(function (value) { | ||
var stateRef = ref(getter(app.state)); | ||
var unwatch = app.watchState(getter).do(function (value) { | ||
stateRef.value = value; | ||
@@ -38,13 +37,3 @@ }); | ||
} | ||
// export function useRallieState<P> (getter: () => P) { | ||
// const stateRef = ref(getter()) | ||
// const runner = effect(() => { | ||
// stateRef.value = getter() as UnwrapRef<P> | ||
// }) | ||
// onBeforeUnmount(() => { | ||
// runner.effect.stop() | ||
// }) | ||
// return stateRef | ||
// } | ||
export { eventsHook, methodsHook, stateHook }; |
@@ -7,7 +7,6 @@ (function (global, factory) { | ||
// import { effect } from '@rallie/core' | ||
function stateHook(state) { | ||
function stateHook(app) { | ||
return function (getter) { | ||
var stateRef = vue.ref(state.get(getter)); | ||
var unwatch = state.watch(getter).do(function (value) { | ||
var stateRef = vue.ref(getter(app.state)); | ||
var unwatch = app.watchState(getter).do(function (value) { | ||
stateRef.value = value; | ||
@@ -43,12 +42,2 @@ }); | ||
} | ||
// export function useRallieState<P> (getter: () => P) { | ||
// const stateRef = ref(getter()) | ||
// const runner = effect(() => { | ||
// stateRef.value = getter() as UnwrapRef<P> | ||
// }) | ||
// onBeforeUnmount(() => { | ||
// runner.effect.stop() | ||
// }) | ||
// return stateRef | ||
// } | ||
@@ -55,0 +44,0 @@ exports.eventsHook = eventsHook; |
{ | ||
"name": "@rallie/vue", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "vue binding for rallie", | ||
@@ -24,12 +24,11 @@ "author": "runnan <1608272694@qq.com>", | ||
}, | ||
"dependencies": { | ||
"rallie": "^0.5.2" | ||
}, | ||
"peerDependencies": { | ||
"rallie": ">=0.5.3", | ||
"vue": ">=3.2.6" | ||
}, | ||
"devDependencies": { | ||
"@rallie/core": "^0.5.2" | ||
"@rallie/core": "^0.6.0", | ||
"rallie": "^0.6.0" | ||
}, | ||
"gitHead": "1e4b57703550354bc5d2a1149a5081a4c5065b5b" | ||
"gitHead": "8be5247aeedca969023dd6d3854b4075abc614a1" | ||
} |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
4910
2
86
1
+ Added@rallie/core@0.10.0(transitive)
+ Addedrallie@0.10.0(transitive)
- Removedrallie@^0.5.2
- Removed@rallie/core@0.5.2(transitive)
- Removedrallie@0.5.2(transitive)
- Removedtslib@2.8.1(transitive)