19 lines
476 B
JavaScript
19 lines
476 B
JavaScript
import { getCurrentScope, onScopeDispose, getCurrentInstance } from 'vue';
|
|
|
|
function tryOnScopeDispose(fn) {
|
|
if (getCurrentScope()) {
|
|
onScopeDispose(fn);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
function getLifeCycleTarget(target) {
|
|
return getCurrentInstance();
|
|
}
|
|
function tryOnUnmounted(fn, target) {
|
|
getLifeCycleTarget();
|
|
}
|
|
|
|
export { tryOnScopeDispose as a, tryOnUnmounted as t };
|