1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-30 22:43:57 +02:00

refactor(frontend): use* 関数の格納場所のフォルダ名を composables に変更 (#16004)

* refactor(frontend): use* 関数の格納場所を正式名称(composables)に変更

* migrate

* move useLoading
This commit is contained in:
かっこかり
2025-05-10 07:58:26 +09:00
committed by GitHub
parent c803f842ba
commit e1cd7c94fb
57 changed files with 53 additions and 53 deletions

View File

@@ -0,0 +1,50 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { Ref } from 'vue';
export function useLeaveGuard(enabled: Ref<boolean>) {
/* TODO
const setLeaveGuard = inject('setLeaveGuard');
if (setLeaveGuard) {
setLeaveGuard(async () => {
if (!enabled.value) return false;
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.ts.leaveConfirm,
});
return canceled;
});
} else {
onBeforeRouteLeave(async (to, from) => {
if (!enabled.value) return true;
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.ts.leaveConfirm,
});
return !canceled;
});
}
*/
/*
function onBeforeLeave(ev: BeforeUnloadEvent) {
if (enabled.value) {
ev.preventDefault();
ev.returnValue = '';
}
}
window.addEventListener('beforeunload', onBeforeLeave);
onUnmounted(() => {
window.removeEventListener('beforeunload', onBeforeLeave);
});
*/
}