我想使用airbnb的eslint修改我的代码结构。我遵循了给出的这些指示。在启动命令npm run lint之后,结果由'fetch' is not defined和'localStorage' is not defined组成。我已经看过这个,但是仍然显示错误为相同的'fetch is not defined'。有什么解决办法吗。
我在我的Rendr应用程序的控制器中得到500 ReferenceError: localStorage is not defined。我试图从localStorage中获取授权令牌,并在获取规范之前将其设置为标头。我也尝试过window.localStorage,但后来没有定义窗口。在控制器级别上,我没有访问窗口对象的权限吗?如果没有,我将如何从localStorage获取。
我正在尝试编写一个围绕localStorage的小包装器,类似于Rails获取缓存结果的方式。Data.find is a block which just returns the data if the cache key was not found var result = localStorage.getItem(key);
if (result) {result = callback();