ブラウザは、ウェブサイトが訪問者のデバイスにデータを保存することを許可します。これを ローカルストレージと呼びます。 getItem()、 storeItem()、 clearStorage()、 およびremoveItem() 関数がこれを制御します。
この例は、Daniel ShiffmanのLoading JSON DataおよびProcessingで書かれたLoading Tabular Dataの例に触発されています。バブルのデータを整理するために クラスを使用しています。訪問者は新しいバブルを追加でき、そのデータはローカルストレージに保存されます。訪問者がスケッチを再訪問すると、同じバブルが再読み込みされます。
ローカルストレージ: Created by Caleb Foss. Inspired by Daniel Shiffman's examples. From 2024 onwards, edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.
You can find the code history of these examples here: 2023 code, pre-2023 JSON example, pre-2023 Table example. You can suggest improvements by contributing to the current website!