mirror of
https://github.com/flutter/samples.git
synced 2026-03-24 13:22:01 +00:00
This adds a tool to measure web app startup for the Material 3 demo. Demo: - [Example app](https://flutter-web-perf-experiments.web.app/) - [Material 3](https://flutter-web-perf-experiments--material3-vswzldcy.web.app/) (open console) --------- Co-authored-by: Brett Morgan <brett.morgan@gmail.com> Co-authored-by: Kevin Moore <kevmoo@google.com>
51 lines
1.6 KiB
HTML
51 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<base href="$FLUTTER_BASE_HREF">
|
|
|
|
<meta charset="UTF-8">
|
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
|
<meta name="description" content="web_startup_analyzer example">
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
<meta name="apple-mobile-web-app-title" content="example">
|
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
|
|
|
<link rel="icon" type="image/png" href="favicon.png"/>
|
|
|
|
<title>web_perf_metrics example</title>
|
|
<link rel="manifest" href="manifest.json">
|
|
|
|
<script>
|
|
const serviceWorkerVersion = null;
|
|
</script>
|
|
<script src="flutter.js" defer></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript" src="assets/packages/web_startup_analyzer/lib/web_startup_analyzer.js"></script>
|
|
<script>
|
|
var flutterWebStartupAnalyzer = new FlutterWebStartupAnalyzer();
|
|
var analyzer = flutterWebStartupAnalyzer;
|
|
|
|
window.addEventListener('load', function(ev) {
|
|
analyzer.markStart("loadEntrypoint");
|
|
_flutter.loader.loadEntrypoint({
|
|
serviceWorker: {
|
|
serviceWorkerVersion: serviceWorkerVersion,
|
|
},
|
|
onEntrypointLoaded: function(engineInitializer) {
|
|
analyzer.markFinished("loadEntrypoint");
|
|
analyzer.markStart("initializeEngine");
|
|
engineInitializer.initializeEngine().then(function(appRunner) {
|
|
analyzer.markFinished("initializeEngine");
|
|
analyzer.markStart("appRunnerRunApp");
|
|
appRunner.runApp();
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|