Improve caching
This commit is contained in:
@@ -13,6 +13,7 @@ declare global {
|
||||
nativeVueHost?: {
|
||||
onBack(callback: () => void): () => void
|
||||
onForward?(callback: () => void): () => void
|
||||
onMemoryPressure?(callback: () => void): () => void
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,9 +26,13 @@ export function createElectronRendererAdapter(): NativePlatformAdapter {
|
||||
if (runtime.canGoBack.value) void runtime.pop()
|
||||
})
|
||||
const removeForward = window.nativeVueHost?.onForward?.(() => runtime.router.forward())
|
||||
const removeMemoryPressure = window.nativeVueHost?.onMemoryPressure?.(() => {
|
||||
runtime.trimCache({ reason: 'memory-pressure' })
|
||||
})
|
||||
return () => {
|
||||
removeBack?.()
|
||||
removeForward?.()
|
||||
removeMemoryPressure?.()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user