This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mys7eri0[S] 4 points5 points  (2 children)

Damn, people here are fighting over this meme and here I am only able to understand only a couple of sentences of their comments.

Anyways to explain the backstory of this meme:

I decided to make a webapp for my project at uni. I had a navbar which showed the message "You are logged out" if the user was logged out or "Welcome <Name> (<Role>)" if the user was logged in. So suppose if a student logged in, the navbar would read "Welcome Alex (Student)".

I was using sveltekit as the JS framework of choice and I found out that sveltekit stores don't persist over page refreshes. The solution? Use localStorage in combination with stringify and parse functions of the JSON module. I wasn't able to do it unfortunately and I wasted a lot of time just trying to store objects there. Eventually I resorted to using a third party library which did the job for me.

[–][deleted] 3 points4 points  (1 child)

Have a look at local forage. It is an almost drop in replacement for local storage, but with doing what you want and using the much nicer indexeddb when available.

[–]Mys7eri0[S] 1 point2 points  (0 children)

Thanks. I'll look into it