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

@ -10,7 +10,7 @@ export default {
},
mounted(src, binding, vn) {
setTimeout(() => {
window.setTimeout(() => {
src.style.opacity = '1';
src.style.transform = 'none';
}, 1);

View File

@ -21,7 +21,7 @@ export default {
self.close = () => {
if (self._close) {
clearInterval(self.checkTimer);
window.clearInterval(self.checkTimer);
self._close();
self._close = null;
}
@ -61,19 +61,19 @@ export default {
});
el.addEventListener(start, () => {
clearTimeout(self.showTimer);
clearTimeout(self.hideTimer);
self.showTimer = setTimeout(self.show, delay);
window.clearTimeout(self.showTimer);
window.clearTimeout(self.hideTimer);
self.showTimer = window.setTimeout(self.show, delay);
}, { passive: true });
el.addEventListener(end, () => {
clearTimeout(self.showTimer);
clearTimeout(self.hideTimer);
self.hideTimer = setTimeout(self.close, delay);
window.clearTimeout(self.showTimer);
window.clearTimeout(self.hideTimer);
self.hideTimer = window.setTimeout(self.close, delay);
}, { passive: true });
el.addEventListener('click', () => {
clearTimeout(self.showTimer);
window.clearTimeout(self.showTimer);
self.close();
});
},
@ -85,6 +85,6 @@ export default {
unmounted(el, binding, vn) {
const self = el._tooltipDirective_;
clearInterval(self.checkTimer);
window.clearInterval(self.checkTimer);
},
} as Directive;

View File

@ -30,11 +30,11 @@ export class UserPreview {
source: this.el
}, {
mouseover: () => {
clearTimeout(this.hideTimer);
window.clearTimeout(this.hideTimer);
},
mouseleave: () => {
clearTimeout(this.showTimer);
this.hideTimer = setTimeout(this.close, 500);
window.clearTimeout(this.showTimer);
this.hideTimer = window.setTimeout(this.close, 500);
},
}, 'closed');
@ -44,10 +44,10 @@ export class UserPreview {
}
};
this.checkTimer = setInterval(() => {
this.checkTimer = window.setInterval(() => {
if (!document.body.contains(this.el)) {
clearTimeout(this.showTimer);
clearTimeout(this.hideTimer);
window.clearTimeout(this.showTimer);
window.clearTimeout(this.hideTimer);
this.close();
}
}, 1000);
@ -56,7 +56,7 @@ export class UserPreview {
@autobind
private close() {
if (this.promise) {
clearInterval(this.checkTimer);
window.clearInterval(this.checkTimer);
this.promise.cancel();
this.promise = null;
}
@ -64,21 +64,21 @@ export class UserPreview {
@autobind
private onMouseover() {
clearTimeout(this.showTimer);
clearTimeout(this.hideTimer);
this.showTimer = setTimeout(this.show, 500);
window.clearTimeout(this.showTimer);
window.clearTimeout(this.hideTimer);
this.showTimer = window.setTimeout(this.show, 500);
}
@autobind
private onMouseleave() {
clearTimeout(this.showTimer);
clearTimeout(this.hideTimer);
this.hideTimer = setTimeout(this.close, 500);
window.clearTimeout(this.showTimer);
window.clearTimeout(this.hideTimer);
this.hideTimer = window.setTimeout(this.close, 500);
}
@autobind
private onClick() {
clearTimeout(this.showTimer);
window.clearTimeout(this.showTimer);
this.close();
}
@ -94,7 +94,7 @@ export class UserPreview {
this.el.removeEventListener('mouseover', this.onMouseover);
this.el.removeEventListener('mouseleave', this.onMouseleave);
this.el.removeEventListener('click', this.onClick);
clearInterval(this.checkTimer);
window.clearInterval(this.checkTimer);
}
}