Phone CPU usage optimization

This commit is contained in:
James Babcock committed 2026-09-22 14:19:23 -07:00
1 parent 44eddedc01
commit 9560f3ac8d
26 files changed
+606 -167

No files matched your search

+4
View File
@@ -15,6 +15,7 @@ type MainPageState = {
model: MainViewModel
propertyChangeHandler: (args: EventData & { propertyName?: string }) => void
orientationHandler: () => void
detachPreview: () => void
}
function getPageState(page: Page): MainPageState | undefined {
@@ -32,6 +33,7 @@ function cleanupPage(page: Page): void {
return
}
state.model.off(Observable.propertyChangeEvent, state.propertyChangeHandler)
state.detachPreview()
Application.off(Application.orientationChangedEvent, state.orientationHandler)
// navigatingTo builds a fresh model each visit; drop the old one's
// controller/settings subscriptions or every navigation leaks a listener.
@@ -130,6 +132,8 @@ export function loaded(args: EventData) {
const state: MainPageState = {
model,
detachPreview: dashboardController.attachPhonePreview(() =>
page.isLoaded && !model.displayPreviewMessage && (!isAndroid || !!page.android?.isShown())),
orientationHandler: () => {
setTimeout(() => {
model.refreshLayoutMetrics()