Skip to content

Commit

Permalink
Merge pull request #76 from xpadev-net/develop
Browse files Browse the repository at this point in the history
release: v0.2.65
  • Loading branch information
xpadev-net authored Nov 29, 2023
2 parents 4d39e49 + 35a8323 commit e80a27d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xpadev-net/niconicomments",
"version": "0.2.64",
"version": "0.2.65",
"description": "NiconiComments is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.",
"main": "dist/bundle.js",
"types": "dist/bundle.d.ts",
Expand Down
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 e80a27d

Please sign in to comment.