Skip to content

Commit 65fc82e

Browse files
committed
fix: remove window
1 parent 0dd6065 commit 65fc82e

File tree

21 files changed

+44
-113
lines changed

21 files changed

+44
-113
lines changed

components/_util/css-animation/Event.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const TransitionEvents = {
8787

8888
addStartEventListener(node, eventListener) {
8989
if (startEvents.length === 0) {
90-
window.setTimeout(eventListener, 0);
90+
setTimeout(eventListener, 0);
9191
return;
9292
}
9393
startEvents.forEach(startEvent => {
@@ -109,7 +109,7 @@ const TransitionEvents = {
109109

110110
addEndEventListener(node, eventListener) {
111111
if (endEvents.length === 0) {
112-
window.setTimeout(eventListener, 0);
112+
setTimeout(eventListener, 0);
113113
return;
114114
}
115115
endEvents.forEach(endEvent => {

components/_util/css-animation/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import Event from './Event';
44
import classes from '../component-classes';
55
import { requestAnimationTimeout, cancelAnimationTimeout } from '../requestAnimationTimeout';
6+
import { inBrowser } from '../env';
67

78
const isCssAnimationSupported = Event.endEvents.length !== 0;
89
const capitalPrefixes = [
@@ -15,6 +16,7 @@ const capitalPrefixes = [
1516
const prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
1617

1718
function getStyleProperty(node, name) {
19+
if (inBrowser) return '';
1820
// old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
1921
const style = window.getComputedStyle(node, null);
2022
let ret = '';

components/_util/dom-closest.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

components/_util/dom-matches.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

components/_util/transition.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const collapseMotion = (style: Ref<CSSProperties>, className: Ref<string>): CSSM
147147
style.value = getCurrentHeight(node);
148148
},
149149
onLeave: node => {
150-
window.setTimeout(() => {
150+
setTimeout(() => {
151151
style.value = getCollapsedHeight(node);
152152
});
153153
},

components/_util/wave.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default defineComponent({
129129
getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible
130130
getComputedStyle(node).getPropertyValue('border-color') ||
131131
getComputedStyle(node).getPropertyValue('background-color');
132-
this.clickWaveTimeoutId = window.setTimeout(() => this.onClick(node, waveColor), 0);
132+
this.clickWaveTimeoutId = setTimeout(() => this.onClick(node, waveColor), 0);
133133
raf.cancel(this.animationStartId);
134134
this.animationStart = true;
135135

components/button/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default defineComponent({
6060
val => {
6161
clearTimeout(delayTimeoutRef.value);
6262
if (typeof loadingOrDelay.value === 'number') {
63-
delayTimeoutRef.value = window.setTimeout(() => {
63+
delayTimeoutRef.value = setTimeout(() => {
6464
innerLoading.value = val;
6565
}, loadingOrDelay.value);
6666
} else {

components/form/ErrorList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ export default defineComponent({
2424
const timeout = ref();
2525
const cacheErrors = ref([...props.errors]);
2626
watch([() => [...props.errors], () => props.help], newValues => {
27-
window.clearTimeout(timeout.value);
27+
clearTimeout(timeout.value);
2828
if (props.help) {
2929
visible.value = !!(props.errors && props.errors.length);
3030
if (visible.value) {
3131
cacheErrors.value = newValues[0];
3232
}
3333
} else {
34-
timeout.value = window.setTimeout(() => {
34+
timeout.value = setTimeout(() => {
3535
visible.value = !!(props.errors && props.errors.length);
3636
if (visible.value) {
3737
cacheErrors.value = newValues[0];
@@ -40,7 +40,7 @@ export default defineComponent({
4040
}
4141
});
4242
onBeforeUnmount(() => {
43-
window.clearTimeout(timeout.value);
43+
clearTimeout(timeout.value);
4444
});
4545
// Memo status in same visible
4646
watch([visible, status], () => {

components/menu/src/Menu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ export default defineComponent({
214214
{ immediate: true },
215215
);
216216

217-
let timeout: number;
217+
let timeout: any;
218218
const changeActiveKeys = (keys: Key[]) => {
219-
window.clearTimeout(timeout);
220-
timeout = window.setTimeout(() => {
219+
clearTimeout(timeout);
220+
timeout = setTimeout(() => {
221221
if (props.activeKey === undefined) {
222222
activeKeys.value = keys;
223223
}

components/statistic/Countdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default defineComponent({
1717
}),
1818
emits: ['finish', 'change'],
1919
setup(props, { emit }) {
20-
const countdownId = ref<number>();
20+
const countdownId = ref<any>();
2121
const statistic = ref();
2222
const syncTimer = () => {
2323
const { value } = props;
@@ -32,7 +32,7 @@ export default defineComponent({
3232
const startTimer = () => {
3333
if (countdownId.value) return;
3434
const timestamp = getTime(props.value);
35-
countdownId.value = window.setInterval(() => {
35+
countdownId.value = setInterval(() => {
3636
statistic.value.$forceUpdate();
3737
if (timestamp > Date.now()) {
3838
emit('change', timestamp - Date.now());

0 commit comments

Comments
 (0)