store cache eagerly
This commit is contained in:
parent
9187c1d31c
commit
21af30f71b
1 changed files with 3 additions and 5 deletions
|
@ -140,6 +140,7 @@ export const applyTheme = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let cache
|
||||||
const { lazyProcessFunc } = generateTheme(
|
const { lazyProcessFunc } = generateTheme(
|
||||||
input,
|
input,
|
||||||
{
|
{
|
||||||
|
@ -152,16 +153,13 @@ export const applyTheme = (
|
||||||
},
|
},
|
||||||
onEagerFinished () {
|
onEagerFinished () {
|
||||||
adoptStyleSheets([eagerStyles])
|
adoptStyleSheets([eagerStyles])
|
||||||
|
cache = { engineChecksum: getEngineChecksum(), data: [eagerStyles.rules, lazyStyles.rules] }
|
||||||
|
localforage.setItem('pleromafe-theme-cache', cache)
|
||||||
onEagerFinish()
|
onEagerFinish()
|
||||||
},
|
},
|
||||||
onLazyFinished () {
|
onLazyFinished () {
|
||||||
adoptStyleSheets([eagerStyles, lazyStyles])
|
adoptStyleSheets([eagerStyles, lazyStyles])
|
||||||
const cache = { engineChecksum: getEngineChecksum(), data: [eagerStyles.rules, lazyStyles.rules] }
|
|
||||||
onFinish(cache)
|
onFinish(cache)
|
||||||
const compress = (js) => {
|
|
||||||
return pako.deflate(JSON.stringify(js))
|
|
||||||
}
|
|
||||||
localforage.setItem('pleromafe-theme-cache', compress(cache))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
debug
|
debug
|
||||||
|
|
Loading…
Add table
Reference in a new issue