Replies: 2 comments 2 replies
-
Unfortunately we don't yet have Preferences working with WASM/WebJS - we intend to do this through local storage, but it is not yet implemented. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Implementation with localstorage was quite simple. I just made a localStorage object which is then passed into the part of the program that needs to handle that. type LocalStorage struct {
}
func (s LocalStorage) GetToken() string {
result := js.Global().Get("window").Get("localStorage").Call("getItem", "token")
if result.IsNull() {
return ""
}
return result.String()
}
func (s LocalStorage) SetToken(token string) {
js.Global().Get("window").Get("localStorage").Call("setItem", "token", token)
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am implementing an application now and testing it on linux, android and firefox. (it is probably mostly gonna be used in browsers)
The application requires login and is then using a token to call a websocket api to stream some commands which are used for opening a door.
So far I had a lot of issues with wasm because of stuff related to websocket :-D But I made it work perfectly now.
There is just one feature I would like to implement: which is persistence of the token so that the user wont have to login every time.
I am wondering if the preference manager in fyne supports webassembly or if I have to implement the persistence functionality myself with the js syscalls?
Beta Was this translation helpful? Give feedback.
All reactions