Skip to content

Commit

Permalink
fix: 履歴表示順を降順にした
Browse files Browse the repository at this point in the history
  • Loading branch information
haruyan-hopemucci committed Feb 18, 2024
1 parent e0a6786 commit 9c78c21
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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())
}
}

Expand Down

0 comments on commit 9c78c21

Please sign in to comment.