Skip to content

Instantly share code, notes, and snippets.

@StefH
Last active June 20, 2020 12:16
Show Gist options
  • Save StefH/5795ae24c4b54ad9320808535286bb00 to your computer and use it in GitHub Desktop.
Save StefH/5795ae24c4b54ad9320808535286bb00 to your computer and use it in GitHub Desktop.
window.loadResourceCallback
<app>
<div class="container-fluid">
<div class="row">
<div class="col-2"></div>
<div class="col-8">
<p></p>
Loading Blazor WebAssembly...
<br />
<div class="progress">
<div id="progressbar" class="progress-bar progress-bar-striped active" role="progressbar" style="width:0"></div>
</div>
</div>
<div class="col-2"></div>
</div>
</div>
</app>
<script type="text/javascript">
var i = 0;
window.loadResourceCallback = (total, name, response) => {
if (name.endsWith('.dll')) {
i++;
const value = parseInt((i * 100.0) / total);
const pct = value + '%';
const progressbar = document.getElementById('progressbar');
progressbar.style.width = pct;
console.log(i + '/' + total + ' (' + pct + ') ' + name);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment