2024-01-29 09:26:07 +08:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2024-08-02 18:19:39 +08:00
|
|
|
exports.useReactivated = useReactivated;
|
2024-01-29 09:26:07 +08:00
|
|
|
const vue_1 = require("vue");
|
|
|
|
function useReactivated(callback) {
|
|
|
|
const isDeactivatedRef = { isDeactivated: false };
|
|
|
|
let activateStateInitialized = false;
|
|
|
|
(0, vue_1.onActivated)(() => {
|
|
|
|
isDeactivatedRef.isDeactivated = false;
|
|
|
|
if (!activateStateInitialized) {
|
|
|
|
activateStateInitialized = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
(0, vue_1.onDeactivated)(() => {
|
|
|
|
isDeactivatedRef.isDeactivated = true;
|
|
|
|
if (!activateStateInitialized) {
|
|
|
|
activateStateInitialized = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return isDeactivatedRef;
|
|
|
|
}
|