From d62136e1802698b0d11c640d8029e9311cfd35af Mon Sep 17 00:00:00 2001
From: DarkWiiPlayer StorageState
subclass of State
implements the same API but is backed by a
Storage
object.
- This comes with the disadvantage that all values must be stored in a - serialised form, which won't work for all data and will break identity. - Specifically, all values are converted to JSON strings for storage. -
-
By default, StorageState
uses the
window.localStorage
object, but you can change this by
@@ -132,6 +125,25 @@
console.log(sessionStorage.value) // udnefined
console.log(sessionStorage.greeting) // "Hello, World!"
+
+
+ Using a storage object comes with the disadvantage that all values must + be stored in a serialised form, which won't work for all data and will + break identity. Specifically, all values are converted to JSON strings + for storage. +
+ +