mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Registering the service worker immediately after the documented has loaded may cause SW initialization to compete with framework initialization. It was recommended to us that we defer the service worker setup until after the framework is done with setup, which should be sometime after the first frame. To implement this, I augmented the binding setup to dispatch an event on the document after the binding has initialized. I don't see any obvious risks with this setup. Fixes #66066
35 lines
1.3 KiB
HTML
35 lines
1.3 KiB
HTML
<!DOCTYPE HTML>
|
|
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
|
|
Use of this source code is governed by a BSD-style license that can be
|
|
found in the LICENSE file. -->
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
|
<meta name="description" content="A demo app for Flutter's material design and cupertino widgets, as well as many other features of the Flutter SDK.">
|
|
|
|
<!-- iOS meta tags & icons -->
|
|
<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="Flutter Gallery">
|
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
|
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
|
|
|
|
<title>Flutter Gallery</title>
|
|
<link rel="manifest" href="manifest.json">
|
|
</head>
|
|
<body>
|
|
<!-- This script installs service_worker.js to provide PWA functionality to
|
|
application. For more information, see:
|
|
https://developers.google.com/web/fundamentals/primers/service-workers -->
|
|
<script>
|
|
if ('serviceWorker' in navigator) {
|
|
window.addEventListener('flutter-first-frame', function () {
|
|
navigator.serviceWorker.register('flutter_service_worker.js');
|
|
});
|
|
}
|
|
</script>
|
|
<script src="main.dart.js" type="application/javascript"></script>
|
|
</body>
|
|
</html>
|