]> git.proxmox.com Git - mirror_novnc.git/commit
Use localstorage only to initialize settings map
authorAndrew Webster <awebster@arcx.com>
Thu, 25 Jan 2018 20:23:08 +0000 (15:23 -0500)
committerAndrew Webster <awebster@arcx.com>
Tue, 13 Feb 2018 15:22:21 +0000 (10:22 -0500)
commite0750f9b2c1495473fdcbb2f22dd97961803bc81
treebc4fac6974d6d17a97a5de9b2f0d216632a5173b
parent37b4d13db81e0e80e117c07b86ff98714c7b6b1a
Use localstorage only to initialize settings map

This only reads from localstorage in order to initialize the settings
map.  After initializaton, reads will return the value from the map.

When writing a value, the settings map and the local storage
are updated, unless the setting is a default value or derived from
the query string.

This has a few advantages:
 1. Saved settings will not be overridden by settings specified in
the query string.  This means a setting could be temporarily changed
using the query string, but once removed from the query string, the
setting would return back to what the user selected.
 2. Default values will not be saved.  If a user has always used
the default value for a setting, then they can move to a new version
with different defaults without clearing localstorage.
 3. Changes made to localstorage in a session running in a different
window will not affect the settings in the current window (until
the page is refreshed).

Regarding eraseSetting:

It is possible that another tab could change the value, leading
to an unexpected value change in the tab that deletes.  However,
this function is currently unused, so this will be evaluted if
and when it used.
app/ui.js
app/webutil.js
karma.conf.js
tests/test.webutil.js [new file with mode: 0644]