-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update web initialization logic
- Loading branch information
1 parent
682b40d
commit 8839e58
Showing
6 changed files
with
91 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/// Keep in mind that this file is not a real javascript file, it is a template | ||
/// that will be processed by the build system to generate the final javascript | ||
/// file. Therefore, we use the mustache syntax, like {{variable}}, to inject | ||
/// values and you might see some linter errors in this file. | ||
|
||
{{flutter_js}} | ||
{{flutter_build_config}} | ||
|
||
const cookieBar = document.querySelector("#cookie-bar"); | ||
const cookieBarButton = document.querySelector("#confirm-cookies"); | ||
const splashCopy = document.querySelector("#splash_copy"); | ||
|
||
const additionalScripts = []; | ||
|
||
let cookiesAcceptanceCompleter; | ||
let hasUserAcceptedCookies = new Promise((resolve) => { | ||
cookiesAcceptanceCompleter = resolve; | ||
}); | ||
|
||
cookieBarButton.addEventListener("click", () => { | ||
console.log("cookieBarButton clicked"); | ||
cookieBar.remove(); | ||
cookiesAcceptanceCompleter(); | ||
}); | ||
|
||
window.addEventListener("load", (event) => { | ||
_flutter.loader.load({ | ||
serviceWorkerSettings: { | ||
serviceWorkerVersion: {{flutter_service_worker_version}}, | ||
}, | ||
onEntrypointLoaded: async function (engineInitializer) { | ||
const appRunner = await engineInitializer.initializeEngine(); | ||
await hasUserAcceptedCookies; | ||
|
||
window.addEventListener("flutter-first-frame", function () { | ||
splashCopy.remove(); | ||
document.body.classList.remove("loading-mode"); | ||
}); | ||
|
||
await appRunner.runApp(); | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters