Add cache-first service worker
This commit is contained in:
parent
b2b5f82486
commit
ca222ff10d
20 changed files with 672 additions and 181 deletions
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-underscore-dangle */
|
||||
import Cookie from 'js-cookie';
|
||||
import { socket as socketActions } from 'state/actions';
|
||||
import { getWrapWidth, setConnectDefaults, appSet } from 'state/app';
|
||||
|
@ -8,9 +9,7 @@ import { find } from 'utils';
|
|||
import { when } from 'utils/observe';
|
||||
import { replace } from 'utils/router';
|
||||
|
||||
export default function initialState({ store }) {
|
||||
const env = JSON.parse(document.getElementById('env').innerHTML);
|
||||
|
||||
function loadState({ store }, env) {
|
||||
store.dispatch(setConnectDefaults(env.defaults));
|
||||
store.dispatch(appSet('hexIP', env.hexIP));
|
||||
store.dispatch(setSettings(env.settings, true));
|
||||
|
@ -70,3 +69,12 @@ export default function initialState({ store }) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default function initialState(ctx) {
|
||||
if (window.__env__) {
|
||||
window.__env__.then(env => loadState(ctx, env));
|
||||
} else {
|
||||
const env = JSON.parse(document.getElementById('env').innerHTML);
|
||||
loadState(ctx, env);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue