Skip to content

Commit

Permalink
Built web
Browse files Browse the repository at this point in the history
Branch: main
Commit: 9aa0b93

package:peanut 5.1.0
  • Loading branch information
ChunhThanhDe committed Nov 5, 2024
1 parent cad83bb commit 3a28bf4
Show file tree
Hide file tree
Showing 4 changed files with 9,584 additions and 9,550 deletions.
2 changes: 1 addition & 1 deletion flutter_bootstrap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flutter_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ const RESOURCES = {"assets/AssetManifest.bin": "bab5a8a7ab084453c1408fb7f67e9f52
"canvaskit/skwasm.worker.js": "89990e8c92bcb123999aa81f7e203b1c",
"favicon.png": "d013459ae83c2741755f17e806da3e85",
"flutter.js": "f393d3c16b631f36852323de8e583132",
"flutter_bootstrap.js": "d47c3265c0fd95f30681e5c6c9e1c26e",
"flutter_bootstrap.js": "f3eeefa87422af79ab1197f59b5d66e2",
"icons/Icon-192.png": "97b1eb6da642b5c879721b4a498d52fd",
"icons/Icon-512.png": "14a9d69f21be7b67853e5350b0a55b36",
"icons/Icon-maskable-192.png": "97b1eb6da642b5c879721b4a498d52fd",
"icons/Icon-maskable-512.png": "14a9d69f21be7b67853e5350b0a55b36",
"index.html": "b26618a76845de972144bcc59384a89a",
"/": "b26618a76845de972144bcc59384a89a",
"main.dart.js": "e1745df382f15a5092f6245f73d5f1a9",
"index.html": "89f671251a0645ae8eabc9ce36b3a45f",
"/": "89f671251a0645ae8eabc9ce36b3a45f",
"main.dart.js": "139db012f418d29a4834e07f92f41ca5",
"manifest.json": "c9d701e059e4bb70e89999148726b0a4",
"version.json": "f10c1d4b94f547b3f03bade8f040b6d4"};
// The application shell files that are downloaded before a service worker can
Expand Down
43 changes: 8 additions & 35 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,42 +46,15 @@
<img id="loading-image" src="./assets/load.gif" alt="Loading...">

<script>
// Variable to track if the app has loaded
let appLoaded = false;

// Check for service worker registration and hide the loading image when ready
if ('serviceWorker' in navigator) {
window.addEventListener('flutter-first-frame', function () {
navigator.serviceWorker.register('flutter_service_worker.js?v=900432827');
appLoaded = true; // Mark the app as loaded
hideLoadingImage();
});
}

// Function to hide the loading image
function hideLoadingImage() {
if (appLoaded) {
document.getElementById('loading-image').style.display = 'none';
}
}

// Ensure the loading image is displayed for at least 3 seconds
const minLoadTime = 3000; // 3 seconds
const startTime = Date.now();

const interval = setInterval(() => {
// Check if the minimum load time has passed and the app has loaded
if (appLoaded && (Date.now() - startTime >= minLoadTime)) {
hideLoadingImage();
clearInterval(interval); // Stop the interval check
// Remove loading image after 10 seconds
window.onload = function () {
setTimeout(function () {
var loadingIndicator = document.getElementById("loading-image");
if (loadingIndicator) {
loadingIndicator.remove();
}
}, 100); // Check every 100ms

// If the minimum load time passes, hide the loading image regardless
setTimeout(() => {
appLoaded = true; // Set to true to bypass any further checks
hideLoadingImage(); // Hide the loading image after 3 seconds if the app hasn't loaded
}, minLoadTime);
}, 10000);
};
</script>

<script src="main.dart.js" type="application/javascript"></script>
Expand Down
Loading

0 comments on commit 3a28bf4

Please sign in to comment.