要写文档了,emmm,先写个文档工具吧——DocMarkdown( 三 )

var total = 0;var receivedLength = 0;Blazor.start({ // start manually with loadBootResourceloadBootResource: function (type, name, defaultUri, integrity) {if (type == "dotnetjs")return defaultUri;if (location.hostname !== 'localhost')defaultUri = defaultUri + '.br';const fetchResources = fetch(defaultUri, { cache: 'no-cache' });return fetchResources.then(async (r) => {const reader = r.body.getReader();let length = +r.headers.get('Content-Length');total += length;var progressbar = document.getElementById('progressBar');let dataLength = 0;let dataArray = [];while (true) {const { done, value } = await reader.read();if (done) {break;}dataArray.push(value);dataLength += value.length;receivedLength += value.length;const percent = Math.round(receivedLength / total * 100)var pct = percent + '%';progressbar.style.width = pct;progressbar.innerText = pct + ' ' + calcSize(receivedLength) + '/' + calcSize(total);console.log('Received: ' + name + ',' + calcSize(dataLength) + '/' + calcSize(length));}let data = https://www.huyubaike.com/biancheng/new Uint8Array(dataLength);let position = 0;for (let array of dataArray) {data.set(array, position);position += array.length;}const contentType = type ==='dotnetwasm' ? 'application/wasm' : 'application/octet-stream';if (location.hostname !== 'localhost') {const decompressedResponseArray = BrotliDecode(data);return new Response(decompressedResponseArray,{ headers: { 'content-type': contentType } });}elsereturn new Response(data,{ headers: { 'content-type': contentType } });});return fetchResources;}});function calcSize(bytes) {if (bytes > 1024 * 1024) {return Math.round(bytes / 1024 / 1024 * 100) / 100 + 'MB';}else if (bytes > 1024) {return Math.round(bytes / 1024 * 100) / 100 + 'KB';}else {return bytes + 'B';}}

要写文档了,emmm,先写个文档工具吧——DocMarkdown

文章插图
这样加载内容就能缩小至2.5MB
效果
要写文档了,emmm,先写个文档工具吧——DocMarkdown

文章插图
链接最终效果,点击访问Github源码地址,点击访问

推荐阅读