Skip to content

Commit

Permalink
fix: use setTimeout/setInterval from window object with correct TS ty…
Browse files Browse the repository at this point in the history
…pe (#294)
  • Loading branch information
ghiscoding committed Aug 17, 2024
1 parent 6181a14 commit 95ba819
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/demo/src/options/options31.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class Example {
],
}) as MultipleSelectInstance;

// setTimeout(() => {
// window.setTimeout(() => {
// this.ms2?.setSelects(['<i class="fa fa-star"></i>1', 2, 3]);
// }, 2000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class MultipleSelectInstance {
protected selectGroupName = '';
protected selectItemName = '';
protected scrolledByMouse = false;
protected openDelayTimer: NodeJS.Timeout | undefined;
protected openDelayTimer?: number;

protected updateDataStart?: number;
protected updateDataEnd?: number;
Expand Down Expand Up @@ -1145,8 +1145,8 @@ export class MultipleSelectInstance {
return new Promise(resolve => {
if (openDelay !== null && openDelay >= 0) {
// eslint-disable-next-line prefer-const
clearTimeout(this.openDelayTimer);
this.openDelayTimer = setTimeout(() => {
window.clearTimeout(this.openDelayTimer);
this.openDelayTimer = window.setTimeout(() => {
this.openDrop();
resolve();
}, openDelay);
Expand Down Expand Up @@ -1283,7 +1283,7 @@ export class MultipleSelectInstance {
this.scrolledByMouse = false;
currentOption.scrollIntoView({ block: 'nearest' });
this.changeCurrentOptionHighlight(currentOption);
setTimeout(() => (this.scrolledByMouse = true), 10);
window.setTimeout(() => (this.scrolledByMouse = true), 10);
}
}
}
Expand Down

0 comments on commit 95ba819

Please sign in to comment.