Local Storage - Live Demo
This is a minimal example of how to use localStorage
through ports.
It remembers user data across sessions. This data may be lost if the user clears their cookies, so it is safest to think of this as a cache rather than normal storage.
Anyway, the important code lives in src/Main.elm
and in index.html
with comments!
Run the following commands:
git clone https://github.com/elm-community/js-integration-examples.git
cd js-integration-examples/localStorage
elm make src/Main.elm --output=elm.js
open index.html
Some terminals may not have an open
command, in which case you should open the index.html file in your browser another way.