mirror of https://github.com/flutter/samples.git
deploy: b05384a4a6
parent
459836e721
commit
39d054eb49
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
"DQEHMnBhY2thZ2VzL2N1cGVydGlub19pY29ucy9hc3NldHMvQ3VwZXJ0aW5vSWNvbnMudHRmDAENAQcFYXNzZXQHMnBhY2thZ2VzL2N1cGVydGlub19pY29ucy9hc3NldHMvQ3VwZXJ0aW5vSWNvbnMudHRm"
|
"DQIHMnBhY2thZ2VzL2N1cGVydGlub19pY29ucy9hc3NldHMvQ3VwZXJ0aW5vSWNvbnMudHRmDAENAQcFYXNzZXQHMnBhY2thZ2VzL2N1cGVydGlub19pY29ucy9hc3NldHMvQ3VwZXJ0aW5vSWNvbnMudHRmBzlwYWNrYWdlcy93ZWJfc3RhcnR1cF9hbmFseXplci9saWIvd2ViX3N0YXJ0dXBfYW5hbHl6ZXIuanMMAQ0BBwVhc3NldAc5cGFja2FnZXMvd2ViX3N0YXJ0dXBfYW5hbHl6ZXIvbGliL3dlYl9zdGFydHVwX2FuYWx5emVyLmpz"
|
@ -1 +1 @@
|
|||||||
{"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]}
|
{"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"],"packages/web_startup_analyzer/lib/web_startup_analyzer.js":["packages/web_startup_analyzer/lib/web_startup_analyzer.js"]}
|
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright 2021 The Flutter team. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// Helper class to capture Flutter web app startup timing information
|
||||||
|
class FlutterWebStartupAnalyzer {
|
||||||
|
timings;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.timings = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
markStart(name) {
|
||||||
|
this.timings[name] = null;
|
||||||
|
performance.mark('flt-' + name + '-started');
|
||||||
|
}
|
||||||
|
markFinished(name) {
|
||||||
|
performance.mark('flt-' + name + '-finished');
|
||||||
|
}
|
||||||
|
capture(name) {
|
||||||
|
var timingName = 'flt-' + name;
|
||||||
|
var started = 'flt-' + name + 'started';
|
||||||
|
try {
|
||||||
|
var measurement = performance.measure('flt-' + name, 'flt-' + name + '-started', 'flt-' + name + '-finished');
|
||||||
|
} catch(e) {
|
||||||
|
// ignore errors if the mark doesn't exist
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.timings[name] = measurement.duration;
|
||||||
|
}
|
||||||
|
captureAll() {
|
||||||
|
for (var [key, value] of Object.entries(this.timings)) {
|
||||||
|
this.capture(key);
|
||||||
|
}
|
||||||
|
// Capture
|
||||||
|
this.timings['load'] = performance.timing.loadEventEnd - performance.timing.domContentLoadedEventEnd;
|
||||||
|
this.timings['domContentLoaded'] = performance.timing.domContentLoadedEventEnd - performance.timing.navigationStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
capturePaint() {
|
||||||
|
const entries = performance.getEntriesByType("paint");
|
||||||
|
// Collect first-paint and first-contentful-paint entries
|
||||||
|
entries.forEach((entry) => {
|
||||||
|
this.timings[entry.name] = entry.startTime;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue