elm-spa/examples/03-local-storage/public/main.js
2021-04-27 01:36:07 -05:00

8 lines
215 B
JavaScript

const app = Elm.Main.init({
flags: JSON.parse(localStorage.getItem('storage'))
})
app.ports.save.subscribe(storage => {
localStorage.setItem('storage', JSON.stringify(storage))
app.ports.load.send(storage)
})