_hyperscript
_hyperscript copied to clipboard
access cookie / localStorage
I want to show a modal the first time a user logs in. Therefore I have a state in a cookie or localStorage, e. g. modalOpen which can either be missing or true and in these cases the modal should be shown. Afterwards it should set/update the cookie/localStorage, e. g. showModal=false
The specific action could be to add a css class (e. g. modal-open) or call an onclick modalId.showModal() (daisyUI)
You can access localStorage as follows:
get localStorage.modalOpen
-- do stuff
set localStorage.modalOpen to value
this saved me :) looks like this is not mentioned anywhere in the docs.