Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

refactor(docs): Added webassembly deployment compression #278

Merged
merged 1 commit into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion doc/TDesign.Docs.WebAssembly/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
</div>

<script src="_framework/blazor.webassembly.js"></script>
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
<script>navigator.serviceWorker.register('service-worker.js');</script>
<script src="js/app.js"></script>
<script src="lib/highlightjs/highlight.min.js"></script>
Expand All @@ -40,5 +40,28 @@
hljs.highlightAll();
}
</script>
<script type="module">
import { BrotliDecode } from './js/decode.min.js';
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
if (type !== 'dotnetjs' && location.hostname !== 'localhost') {
return (async function () {
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
throw new Error(response.statusText);
}
const originalResponseBuffer = await response.arrayBuffer();
const originalResponseArray = new Int8Array(originalResponseBuffer);
const decompressedResponseArray = BrotliDecode(originalResponseArray);
const contentType = type ===
'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
return new Response(decompressedResponseArray,
{ headers: { 'content-type': contentType } });
})();
}
}
});
</script>

</body>
</html>
1 change: 1 addition & 0 deletions doc/TDesign.Docs.WebAssembly/wwwroot/js/decode.min.js

Large diffs are not rendered by default.