doodle/pkg/wasm/localstorage.go
Noah Petherbridge 35a89e5dbe WASM: Store User Files in localStorage
* In WASM build, user levels and doodads are written to localStorage
  using their userdir path as keys (".config/levels/test.level")
* LoadFile() and WriteFile() for both Levels and Doodads interact with
  the localStorage for WASM build instead of filesystem for desktop.
* userdir.ListLevels() and ListDoodads() for WASM scan the localStorage
  keys for file names.
* userdir.ResolvePath() now works for WASM (previously was dummied out),
  checks for the file in localStorage.
2019-06-27 15:59:18 -07:00

21 lines
502 B
Go

// +build !js
package wasm
// StorageKeys returns the list of localStorage keys matching a prefix.
// This is a no-op when not in wasm.
func StorageKeys(prefix string) []string {
return []string{}
}
// SetSession sets a binary value on sessionStorage.
// This is a no-op when not in wasm.
func SetSession(key string, value string) {
}
// GetSession retrieves a binary value from sessionStorage.
// This is a no-op when not in wasm.
func GetSession(key string) (string, bool) {
return "", false
}