Skip to content

Commit

Permalink
Merge pull request #75 from xpadev-net/fix/types
Browse files Browse the repository at this point in the history
fix: change to use window.setTimeout instead of Nodejs.setTimeout
  • Loading branch information
xpadev-net authored Nov 29, 2023
2 parents 2d100e9 + ba4cf6e commit 253e559
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/comments/BaseComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ class BaseComment implements IComment {
const cache = imageCache[this.cacheKey];
if (cache) {
this.image = cache.image;
setTimeout(
window.setTimeout(
() => {
delete this.image;
},
this.comment.long * 10 + config.cacheAge,
);
clearTimeout(cache.timeout);
cache.timeout = setTimeout(
cache.timeout = window.setTimeout(
() => {
imageCache[this.cacheKey]?.image.destroy();
delete imageCache[this.cacheKey];
Expand Down Expand Up @@ -312,14 +312,14 @@ class BaseComment implements IComment {
*/
protected _cacheImage(image: IRenderer) {
this.image = image;
setTimeout(
window.setTimeout(
() => {
delete this.image;
},
this.comment.long * 10 + config.cacheAge,
);
imageCache[this.cacheKey] = {
timeout: setTimeout(
timeout: window.setTimeout(
() => {
delete imageCache[this.cacheKey];
},
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/cache.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IRenderer } from "@/@types/renderer";

let imageCache: {
[key: string]: { image: IRenderer; timeout: number | NodeJS.Timeout };
[key: string]: { image: IRenderer; timeout: number };
} = {};

/**
Expand Down

0 comments on commit 253e559

Please sign in to comment.