Proxy & localStorage no longer working in v20170423
See original GitHub issuelast time I ran my project through Closure everything went fine (with version v20170218). But now today with version v20170423 it gets errors, with absolutely nothing changed in the file:
app.js:260: ERROR - variable current_player is undeclared
current_player = +player;
^^^^^^^^^^^^^^
app.js:280: ERROR - variable localStorage is undeclared
localStorage.setItem("savestate", JSON.stringify(savestate));
^^^^^^^^^^^^
app.js:312: ERROR - variable Proxy is undeclared
const undo_history = new Proxy(_move_history[0], {
^^^^^
app.js:451: ERROR - variable right_click_tile is undeclared
if (right_click_tile !== null)
^^^^^^^^^^^^^^^^
but in the web interface it does not get any error.
I run my file with those settings:
- compilation_level
ADVANCED_OPTIMIZATIONS
- language_in
ES7
- language_out
ES5_STRICT
Source: https://gitlab.com/gumiko/contagion/blob/master/app.js
My build script gets Closure from http://dl.google.com/closure-compiler/compiler-latest.zip
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (14 by maintainers)
Top Results From Across the Web
ExtJS localstorage proxy model/store issue - Stack Overflow
I'm using ExtJS 5.1.0 and running into a strange problem. I have the following model:
Read more >Window.localStorage - Web APIs | MDN
The localStorage read-only property of the window interface allows you to access a Storage object for the Document's origin; the stored data ...
Read more >local-storage-proxy - npm
A proxy for accessing localstorage as an object. ... Start using local-storage-proxy in your project by running `npm i local-storage-proxy`.
Read more >How to get/set cookies, sessionStorage and localStorage in ...
In this post, I will show you how to use Agenty's scraping agent to get/set cookies, sessionStorage and localStorage using Puppeteer and Chromium...
Read more >JavaScript Proxy with Storage - David Walsh Blog
Whether it's sessionStorage , localStorage , or IndexedDB, you can use a proxy to make the API much easier to work with!
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@brad4d, the problem is that the compiler doesn’t know what a
localStorage
is. Right now you have to manually declarelocalStorage
in anextern.js
, which is weird, because Storage API have been supported by all major browsers for 10 years now, and is used often.Here are the steps to reproduce:
Contents of
app.js
Compiler arguments
Output:
Does it make the issue clearer?
P.S. Example of a
localStorage
declaration as an extern:No it’s the other way around. All global externs are added to the window object if they don’t exist.