From 9c78c2198befae1d0aa99d0c78f4e92dfb4612bb Mon Sep 17 00:00:00 2001 From: haruyan-hopemucci Date: Sun, 18 Feb 2024 23:14:40 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B1=A5=E6=AD=B4=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E9=A0=86=E3=82=92=E9=99=8D=E9=A0=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/js/app.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/js/app.js b/docs/js/app.js index b4e11e8..939536d 100644 --- a/docs/js/app.js +++ b/docs/js/app.js @@ -15,7 +15,7 @@ const getHistoryKeys = () => { const hkey = localStorage.key(i) hkey.startsWith(KEY_LOCALSTORAGE_KEY_PREFIX) && imgHistoryKeys.push(hkey) } - imgHistoryKeys.sort() + imgHistoryKeys.sort().reverse() return imgHistoryKeys } @@ -37,8 +37,7 @@ const addHistory = (dataUrl) => { localStorage.setItem(`${KEY_LOCALSTORAGE_KEY_PREFIX}${timestamp}`, dataUrl) const imgHistoryKeys = getHistoryKeys() while (imgHistoryKeys.length > MAX_HISTORY_NUM) { - localStorage.removeItem(imgHistoryKeys[0]) - imgHistoryKeys.shift() + localStorage.removeItem(imgHistoryKeys.pop()) } }