A common technique is just to load and save an entire Dictionary object's JSON which covers most of this.
LocalStorage is asynchronous (i.e. setting/getting fires a trigger after a moment, rather than being immediately available) which means it can't really be mapped to anything synchronous (like setting/getting global variables). If a "get global variable" or similar turns in to a "get localstorage value", that value is not immediately available, and may fail as well. So that's not actually possible, without some kind of internal caching mechanism, which is basically the same as doing the save/load dictionary object technique.