We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 247110e commit d0301a0Copy full SHA for d0301a0
1 file changed
config/polyfills.js
@@ -28,3 +28,25 @@ Object.assign = require('object-assign');
28
if (process.env.NODE_ENV === 'test') {
29
require('raf').polyfill(global);
30
}
31
+
32
+// localStorage
33
+const localStorageMock = (function() {
34
+ let store = {};
35
36
+ return {
37
+ getItem: function(key) {
38
+ return store[key] || null;
39
+ },
40
+ setItem: function(key, value) {
41
+ store[key] = value.toString();
42
43
+ clear: function() {
44
+ store = {};
45
+ }
46
+ };
47
48
+})();
49
50
+Object.defineProperty(window, 'localStorage', {
51
+ value: localStorageMock
52
+});
0 commit comments