@rallie/vue
Advanced tools
Comparing version 0.5.1 to 0.5.2
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<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; | ||
export declare function stateHook<T extends object>(state: State<T> | ReadOnlyState<T>): <P>(getter: (_state: T) => 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 getStateHook(state) { | ||
function stateHook(state) { | ||
return function (getter) { | ||
@@ -16,21 +16,21 @@ var stateRef = ref(state.get(getter)); | ||
} | ||
function getBroadcastHook(app) { | ||
function eventsHook(app) { | ||
return function (events) { | ||
var offBroadcast = null; | ||
var off = null; | ||
onBeforeMount(function () { | ||
offBroadcast = app.onBroadcast(events); | ||
off = app.listenEvents(events); | ||
}); | ||
onBeforeUnmount(function () { | ||
offBroadcast(); | ||
off(); | ||
}); | ||
}; | ||
} | ||
function getUnicastHook(app) { | ||
function methodsHook(app) { | ||
return function (events) { | ||
var offUnicast = null; | ||
var off = null; | ||
onBeforeMount(function () { | ||
offUnicast = app.onUnicast(events); | ||
off = app.addMethods(events); | ||
}); | ||
onBeforeUnmount(function () { | ||
offUnicast(); | ||
off(); | ||
}); | ||
@@ -50,2 +50,2 @@ }; | ||
export { getBroadcastHook, getStateHook, getUnicastHook }; | ||
export { eventsHook, methodsHook, stateHook }; |
@@ -8,3 +8,3 @@ (function (global, factory) { | ||
// import { effect } from '@rallie/core' | ||
function getStateHook(state) { | ||
function stateHook(state) { | ||
return function (getter) { | ||
@@ -21,21 +21,21 @@ var stateRef = vue.ref(state.get(getter)); | ||
} | ||
function getBroadcastHook(app) { | ||
function eventsHook(app) { | ||
return function (events) { | ||
var offBroadcast = null; | ||
var off = null; | ||
vue.onBeforeMount(function () { | ||
offBroadcast = app.onBroadcast(events); | ||
off = app.listenEvents(events); | ||
}); | ||
vue.onBeforeUnmount(function () { | ||
offBroadcast(); | ||
off(); | ||
}); | ||
}; | ||
} | ||
function getUnicastHook(app) { | ||
function methodsHook(app) { | ||
return function (events) { | ||
var offUnicast = null; | ||
var off = null; | ||
vue.onBeforeMount(function () { | ||
offUnicast = app.onUnicast(events); | ||
off = app.addMethods(events); | ||
}); | ||
vue.onBeforeUnmount(function () { | ||
offUnicast(); | ||
off(); | ||
}); | ||
@@ -55,5 +55,5 @@ }; | ||
exports.getBroadcastHook = getBroadcastHook; | ||
exports.getStateHook = getStateHook; | ||
exports.getUnicastHook = getUnicastHook; | ||
exports.eventsHook = eventsHook; | ||
exports.methodsHook = methodsHook; | ||
exports.stateHook = stateHook; | ||
@@ -60,0 +60,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "@rallie/vue", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "vue binding for rallie", | ||
@@ -25,3 +25,3 @@ "author": "runnan <1608272694@qq.com>", | ||
"dependencies": { | ||
"rallie": "^0.5.1" | ||
"rallie": "^0.5.2" | ||
}, | ||
@@ -31,3 +31,6 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "37ae2d9a65e159cb8a32d50cc7751be8cc440807" | ||
"devDependencies": { | ||
"@rallie/core": "^0.5.2" | ||
}, | ||
"gitHead": "1e4b57703550354bc5d2a1149a5081a4c5065b5b" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
5599
1
Updatedrallie@^0.5.2