Files
freeCodeCamp/client/cold-reload.js
Berkeley Martinez 4e12c45057 Add webpack cold reloading
On changes to the react bundle
webpack will store the current redux state
in localStorage, waits (to allow the server to restart)
then refreshes the page. On page load, it checks if it
has state stored and loads it into the app.
2016-07-28 23:39:17 -07:00

17 lines
314 B
JavaScript

import store from 'store';
const key = '__cold-storage__';
export function isColdStored() {
return store.has(key);
}
export function getColdStorage() {
const coldReloadData = store.get(key);
store.remove(key);
return coldReloadData;
}
export function saveToColdStorage(data) {
store.set(key, data);
}