Skip to content

Commit

Permalink
feat: adjust app boot flow
Browse files Browse the repository at this point in the history
  • Loading branch information
zgq354 committed Dec 28, 2024
1 parent 4c3bd14 commit bf53eda
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions packages/flarum/core/views/frontend/app.blade.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
<!doctype html>
<html @if ($direction) dir="{{ $direction }}" @endif
@if ($language) lang="{{ $language }}" @endif>
<head>
<meta charset="utf-8">
<title>{{ $title }}</title>
<head>
<meta charset="utf-8">
<title>{{ $title }}</title>

{!! $head !!}
</head>
{!! $head !!}
</head>

<body>
{!! $layout !!}
<body>
{!! $layout !!}

<div id="modal"></div>
<div id="alerts"></div>
<div id="modal"></div>
<div id="alerts"></div>

<script>
document.getElementById('flarum-loading').style.display = 'block';
var flarum = {extensions: {}};
</script>
<script>
document.getElementById('flarum-loading').style.display = 'block';
var flarum = {extensions: {}};
</script>

{!! $js !!}
{!! $js !!}

<script id="flarum-json-payload" type="application/json">@json($payload)</script>
<script id="flarum-json-payload" type="application/json">
@json($payload)
</script>

<script>
<script async>
var boot = function() {
const data = JSON.parse(document.getElementById('flarum-json-payload').textContent);
document.getElementById('flarum-loading').style.display = 'none';
try {
flarum.core.app.load(data);
flarum.core.app.bootExtensions(flarum.extensions);
Expand All @@ -37,8 +39,12 @@
error.style.display = 'block';
throw e;
}
</script>

{!! $foot !!}
</body>
};
setTimeout(() => {
boot();
});
</script>

{!! $foot !!}
</body>
</html>

0 comments on commit bf53eda

Please sign in to comment.