​​JavaScript​IndexedDB,Web Storage,トラブルシュート

Thumbnail of post image 183

一覧のキャッシュや下書きをlocalStorageに保存していると、容量の上限(約5MB)を超えたところでQuotaExceededErrorが出て保存が止まります。Chromiumで上限を測り、try…catchで受け止 ...

​​React​IndexedDB,Playwright,Storage API,TypeScript

Thumbnail of post image 070

React で navigator.storage.estimate() を呼び、サイトが使っている容量と上限を表示するコンポーネントを作りました。一度取得した値は保存しても自動では更新されないので取り直すこと、http のページでは ...

​​React​IndexedDB,Playwright,TypeScript,useEffect

Thumbnail of post image 112

​

React のアプリで、ブラウザの IndexedDB にメモを保存し、次に開いたときに読み出す方法です。IndexedDB の操作を Promise を返す関数にまとめ、useEffect で読み込みます。Date などがそのまま戻 ...