@@ -15,6 +15,7 @@ import type {
15
15
PerformanceObserverOptions ,
16
16
} from '@dcloudio/uni-app-x/types/uni'
17
17
import { onAfterRoute , onBeforeRoute , onPageReady } from '../route/performance'
18
+ import { getNativeApp } from '../../framework/app/app'
18
19
19
20
// TODO
20
21
const APP_LAUNCH = 'appLaunch'
@@ -28,15 +29,15 @@ const ENTRY_TYPE_NAVIGATION = 'navigation'
28
29
const RENDER_TYPE_FIRST_LAYOUT = 'firstLayout'
29
30
const RENDER_TYPE_FIRST_RENDER = 'firstRender'
30
31
31
- const AppStartDuration = 1
32
+ // const AppStartDuration = 1
32
33
// const PageRenderDuration = 1
33
34
// const PageLayoutDuration = 2
34
35
// const PageRenderCount = 3
35
36
// const PageLayoutCount = 4
36
37
// const PageFirstRenderStartTime = 5
37
38
// const PageFirstLayoutStartTime = 6
38
- const PageFirstPageRenderDuration = 7
39
- const PageFirstPageLayoutDuration = 8
39
+ // const PageFirstPageRenderDuration = 7
40
+ // const PageFirstPageLayoutDuration = 8
40
41
41
42
/// status machine
42
43
class PerformanceEntryStatus {
@@ -120,10 +121,7 @@ class PerformanceEntryStatusLayout extends PerformanceEntryStatus {
120
121
const innerPage = super . getCurrentInnerPage ( )
121
122
if ( innerPage != null ) {
122
123
// @ts -expect-error
123
- this . _entryData . duration = nativePage . getDuration (
124
- innerPage . pageId ,
125
- PageFirstPageLayoutDuration
126
- )
124
+ this . _entryData . duration = innerPage . getFirstPageLayoutDuration ( )
127
125
}
128
126
}
129
127
}
@@ -146,10 +144,7 @@ class PerformanceEntryStatusRender extends PerformanceEntryStatus {
146
144
const innerPage = super . getCurrentInnerPage ( )
147
145
if ( innerPage != null ) {
148
146
// @ts -expect-error
149
- this . _entryData . duration = nativePage . getDuration (
150
- innerPage . pageId ,
151
- PageFirstPageRenderDuration
152
- )
147
+ this . _entryData . duration = innerPage . getFirstPageRenderDuration ( )
153
148
}
154
149
}
155
150
}
@@ -173,7 +168,7 @@ class PerformanceEntryStatusNavigation extends PerformanceEntryStatus {
173
168
this . _entryData . duration = Date . now ( ) - this . _entryData . startTime
174
169
if ( this . _entryData . name == APP_LAUNCH ) {
175
170
// @ts -expect-error
176
- this . _entryData . duration += nativePage . getDuration ( AppStartDuration )
171
+ this . _entryData . duration += getNativeApp ( ) . getAppStartDuration ( )
177
172
}
178
173
}
179
174
}
0 commit comments