From f4d1fcaf67716aa710d271e7f56c4f78cd202f29 Mon Sep 17 00:00:00 2001 From: yupix Date: Mon, 10 Jul 2023 15:55:10 +0900 Subject: feat: ユーザーをcontextmenuからアンテナに追加できるようになど (#11206) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: ユーザーをcontextmenuからアンテナに追加できるように close #11115 * MkAvatars.vue変更 * nanka iroiro * fix MkAvatars * ix * fix --------- Co-authored-by: tamaina --- packages/frontend/src/scripts/cache.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packages/frontend/src/scripts/cache.ts') diff --git a/packages/frontend/src/scripts/cache.ts b/packages/frontend/src/scripts/cache.ts index 858e5f03bf..a61d858353 100644 --- a/packages/frontend/src/scripts/cache.ts +++ b/packages/frontend/src/scripts/cache.ts @@ -1,7 +1,8 @@ +import { ref } from "vue"; export class Cache { private cachedAt: number | null = null; - private value: T | undefined; + public value = ref(); private lifetime: number; constructor(lifetime: Cache['lifetime']) { @@ -10,21 +11,20 @@ export class Cache { public set(value: T): void { this.cachedAt = Date.now(); - this.value = value; + this.value.value = value; } - public get(): T | undefined { + private get(): T | undefined { if (this.cachedAt == null) return undefined; if ((Date.now() - this.cachedAt) > this.lifetime) { - this.value = undefined; + this.value.value = undefined; this.cachedAt = null; return undefined; } - return this.value; + return this.value.value; } public delete() { - this.value = undefined; this.cachedAt = null; } -- cgit v1.2.3-freya