aboutsummaryrefslogtreecommitdiff
path: root/emcclib.js
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-04-24 14:24:19 +0100
committerSimon Tatham <anakin@pobox.com>2023-04-24 14:24:19 +0100
commit20d424bf1bef4c1ed249ec3c72a859deb926e207 (patch)
treef2a00550dbf5b42bb5008f17d62d7eb774e7a327 /emcclib.js
parent43db4aa38e83595dc6df245cb952795f9f306ed0 (diff)
downloadpuzzles-20d424bf1bef4c1ed249ec3c72a859deb926e207.zip
puzzles-20d424bf1bef4c1ed249ec3c72a859deb926e207.tar.gz
puzzles-20d424bf1bef4c1ed249ec3c72a859deb926e207.tar.bz2
puzzles-20d424bf1bef4c1ed249ec3c72a859deb926e207.tar.xz
Emscripten: change the localStorage key used for preferences.
I picked pathname + "#preferences" because Ben suggested either that or pathname + "/preferences", and I thought the former sounded neater. But Ben now suggests that it might be better to avoid using # in the key, just in case anyone should later want to use the whole URL _including_ the fragment ID as the key for some other localStorage usage - for example, autosaved progress per puzzle _instance_, keying off the puzzle URL with a fragment ID in the game description. So, per Ben's replacement suggestion, change the "#" to a space.
Diffstat (limited to 'emcclib.js')
-rw-r--r--emcclib.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/emcclib.js b/emcclib.js
index d161c49..8dd1554 100644
--- a/emcclib.js
+++ b/emcclib.js
@@ -801,7 +801,7 @@ mergeInto(LibraryManager.library, {
*/
js_save_prefs: function(buf) {
var prefsdata = UTF8ToString(buf);
- localStorage.setItem(location.pathname + "#preferences", prefsdata);
+ localStorage.setItem(location.pathname + " preferences", prefsdata);
},
/*
@@ -811,7 +811,7 @@ mergeInto(LibraryManager.library, {
* pass it back in as a string, via prefs_load_callback.
*/
js_load_prefs: function(me) {
- var prefsdata = localStorage.getItem(location.pathname+"#preferences");
+ var prefsdata = localStorage.getItem(location.pathname+" preferences");
if (prefsdata !== undefined && prefsdata !== null) {
prefs_load_callback(me, prefsdata);
}