@rallie/vue
Advanced tools
Comparing version 0.5.0-alpha.0 to 0.5.0
@@ -0,4 +1,5 @@ | ||
import { UnwrapRef } from 'vue'; | ||
import { App, Connector, State, ReadOnlyState } from 'rallie'; | ||
export declare function getStateHook<T extends object>(state: State<T> | ReadOnlyState<T>): <P>(getter: (_state: T) => P) => import("vue").Ref<import("vue").UnwrapRef<P>>; | ||
export declare function getBroadcastHooks<BroadcastEvents>(app: App): (events: Partial<BroadcastEvents>) => void; | ||
export declare function getUnicastHooks<UnicastEvents>(app: App | Connector): (events: Partial<UnicastEvents>) => void; | ||
export declare function getStateHook<T extends object>(state: State<T> | ReadOnlyState<T>): <P>(getter: (_state: T) => P) => import("vue").Ref<UnwrapRef<P>>; | ||
export declare function getBroadcastHook<BroadcastEvents>(app: App): (events: Partial<BroadcastEvents>) => void; | ||
export declare function getUnicastHook<UnicastEvents>(app: App | Connector): (events: Partial<UnicastEvents>) => void; |
import { ref, onBeforeUnmount, onBeforeMount } from 'vue'; | ||
// import { effect } from '@rallie/core' | ||
function getStateHook(state) { | ||
@@ -15,3 +16,3 @@ return function (getter) { | ||
} | ||
function getBroadcastHooks(app) { | ||
function getBroadcastHook(app) { | ||
return function (events) { | ||
@@ -27,3 +28,3 @@ var offBroadcast = null; | ||
} | ||
function getUnicastHooks(app) { | ||
function getUnicastHook(app) { | ||
return function (events) { | ||
@@ -39,3 +40,13 @@ var offUnicast = null; | ||
} | ||
// 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 { getBroadcastHooks, getStateHook, getUnicastHooks }; | ||
export { getBroadcastHook, getStateHook, getUnicastHook }; |
@@ -7,2 +7,3 @@ (function (global, factory) { | ||
// import { effect } from '@rallie/core' | ||
function getStateHook(state) { | ||
@@ -20,3 +21,3 @@ return function (getter) { | ||
} | ||
function getBroadcastHooks(app) { | ||
function getBroadcastHook(app) { | ||
return function (events) { | ||
@@ -32,3 +33,3 @@ var offBroadcast = null; | ||
} | ||
function getUnicastHooks(app) { | ||
function getUnicastHook(app) { | ||
return function (events) { | ||
@@ -44,6 +45,16 @@ var offUnicast = null; | ||
} | ||
// 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 | ||
// } | ||
exports.getBroadcastHooks = getBroadcastHooks; | ||
exports.getBroadcastHook = getBroadcastHook; | ||
exports.getStateHook = getStateHook; | ||
exports.getUnicastHooks = getUnicastHooks; | ||
exports.getUnicastHook = getUnicastHook; | ||
@@ -50,0 +61,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "@rallie/vue", | ||
"version": "0.5.0-alpha.0", | ||
"version": "0.5.0", | ||
"description": "vue binding for rallie", | ||
@@ -22,9 +22,8 @@ "author": "runnan <1608272694@qq.com>", | ||
"dependencies": { | ||
"rallie": "^0.5.0-alpha.0" | ||
"rallie": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
"vue": ">=3.2.6" | ||
}, | ||
"gitHead": "66a13f57c77ddf86a279447e2d13f9a2b897f984" | ||
"gitHead": "221e72d8d8e680fbd8bc2073f306f8dd34c320ac" | ||
} |
@@ -1,3 +0,4 @@ | ||
import { onBeforeUnmount, onBeforeMount, ref } from 'vue' | ||
import { onBeforeUnmount, onBeforeMount, ref, UnwrapRef } from 'vue' | ||
import { App, Connector, State, ReadOnlyState } from 'rallie' | ||
// import { effect } from '@rallie/core' | ||
@@ -8,3 +9,3 @@ export function getStateHook<T extends object> (state: State<T> | ReadOnlyState<T>) { | ||
const unwatch = state.watch(getter).do((value) => { | ||
stateRef.value = value | ||
stateRef.value = value as UnwrapRef<P> | ||
}) | ||
@@ -41,1 +42,12 @@ onBeforeUnmount(() => { | ||
} | ||
// 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 | ||
// } |
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"jsx": "preserve", | ||
"outDir": "./dist", /* Redirect output structure to the directory. */ | ||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ | ||
"composite": true, /* Enable project compilation */ | ||
"composite": true /* Enable project compilation */ | ||
}, | ||
"exclude": [ | ||
"test", | ||
"dist" | ||
"dist", | ||
"test" | ||
], | ||
"include": [ | ||
"./global.d.ts", | ||
"./src" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
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
14461
2
19
317
0
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.26.7(transitive)
+ Added@babel/types@7.26.7(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@vue/compiler-core@3.5.13(transitive)
+ Added@vue/compiler-dom@3.5.13(transitive)
+ Added@vue/compiler-sfc@3.5.13(transitive)
+ Added@vue/compiler-ssr@3.5.13(transitive)
+ Added@vue/runtime-core@3.5.13(transitive)
+ Added@vue/runtime-dom@3.5.13(transitive)
+ Added@vue/server-renderer@3.5.13(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedestree-walker@2.0.2(transitive)
+ Addedmagic-string@0.30.17(transitive)
+ Addednanoid@3.3.8(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.5.1(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedvue@3.5.13(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedreact@17.0.2(transitive)
- Removedreact-dom@17.0.2(transitive)
- Removedscheduler@0.20.2(transitive)
Updatedrallie@^0.5.0