refactor(client): specify global scope

This commit is contained in:
syuilo
2022-01-16 10:14:14 +09:00
parent b312846ff6
commit 8322c90834
30 changed files with 75 additions and 75 deletions

View File

@ -104,9 +104,9 @@ const tick = () => {
tick();
const intervalId = setInterval(tick, 1000);
const intervalId = window.setInterval(tick, 1000);
onUnmounted(() => {
clearInterval(intervalId);
window.clearInterval(intervalId);
});
defineExpose<WidgetComponentExpose>({

View File

@ -67,12 +67,12 @@ const tick = () => {
tick();
watch(() => widgetProps.showMs, () => {
if (intervalId) clearInterval(intervalId);
intervalId = setInterval(tick, widgetProps.showMs ? 10 : 1000);
if (intervalId) window.clearInterval(intervalId);
intervalId = window.setInterval(tick, widgetProps.showMs ? 10 : 1000);
}, { immediate: true });
onUnmounted(() => {
clearInterval(intervalId);
window.clearInterval(intervalId);
});
defineExpose<WidgetComponentExpose>({

View File

@ -66,9 +66,9 @@ const fetch = async () => {
onMounted(() => {
fetch();
const intervalId = setInterval(fetch, 1000 * 60);
const intervalId = window.setInterval(fetch, 1000 * 60);
onUnmounted(() => {
clearInterval(intervalId);
window.clearInterval(intervalId);
});
});

View File

@ -51,8 +51,8 @@ const saveMemo = () => {
const onChange = () => {
changed.value = true;
clearTimeout(timeoutId);
timeoutId = setTimeout(saveMemo, 1000);
window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(saveMemo, 1000);
};
watch(() => defaultStore.reactiveState.memo, newText => {

View File

@ -45,9 +45,9 @@ const tick = () => {
onMounted(() => {
tick();
const intervalId = setInterval(tick, 1000 * 15);
const intervalId = window.setInterval(tick, 1000 * 15);
onUnmounted(() => {
clearInterval(intervalId);
window.clearInterval(intervalId);
});
});

View File

@ -62,9 +62,9 @@ watch(() => widgetProps.url, tick);
onMounted(() => {
tick();
const intervalId = setInterval(tick, 60000);
const intervalId = window.setInterval(tick, 60000);
onUnmounted(() => {
clearInterval(intervalId);
window.clearInterval(intervalId);
});
});

View File

@ -59,7 +59,7 @@ const change = () => {
slideB.value.style.backgroundImage = img;
slideB.value.classList.add('anime');
setTimeout(() => {
window.setTimeout(() => {
// 既にこのウィジェットがunmountされていたら要素がない
if (slideA.value == null) return;
@ -101,9 +101,9 @@ onMounted(() => {
fetch();
}
const intervalId = setInterval(change, 10000);
const intervalId = window.setInterval(change, 10000);
onUnmounted(() => {
clearInterval(intervalId);
window.clearInterval(intervalId);
});
});

View File

@ -60,9 +60,9 @@ const fetch = () => {
onMounted(() => {
fetch();
const intervalId = setInterval(fetch, 1000 * 60);
const intervalId = window.setInterval(fetch, 1000 * 60);
onUnmounted(() => {
clearInterval(intervalId);
window.clearInterval(intervalId);
});
});