| 1 |
<!doctype html> |
| 2 |
<html lang="en-us"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> |
| 7 |
<link rel="stylesheet" href="common/emscripten.css"/> |
| 8 |
<link rel="stylesheet" href="common/testing.css"/> |
| 9 |
<title>speedtest1-wasmfs.wasm</title> |
| 10 |
</head> |
| 11 |
<body> |
| 12 |
<header id='titlebar'><span>speedtest1-wasmfs.wasm</span></header> |
| 13 |
<div>See also: <a href='speedtest1-worker.html'>speedtest1-worker</a></div> |
| 14 |
<div class='warning'>Achtung: running it with the dev tools open may |
| 15 |
<em>drastically</em> slow it down. For faster results, keep the dev |
| 16 |
tools closed when running it! |
| 17 |
</div> |
| 18 |
<div id='test-output'></div> |
| 19 |
<script> |
| 20 |
(function(){ |
| 21 |
const eOut = document.querySelector('#test-output'); |
| 22 |
const log2 = function(cssClass,...args){ |
| 23 |
const ln = document.createElement('div'); |
| 24 |
if(cssClass) ln.classList.add(cssClass); |
| 25 |
ln.append(document.createTextNode(args.join(' '))); |
| 26 |
eOut.append(ln); |
| 27 |
//this.e.output.lastElementChild.scrollIntoViewIfNeeded(); |
| 28 |
}; |
| 29 |
/* can't update DOM while speedtest is running unless we run |
| 30 |
speedtest in a worker thread. */; |
| 31 |
const log = (...args)=>{ |
| 32 |
console.log(...args); |
| 33 |
log2('',...args); |
| 34 |
}; |
| 35 |
const logErr = function(...args){ |
| 36 |
console.error(...args); |
| 37 |
log2('error',...args); |
| 38 |
}; |
| 39 |
const W = new Worker( |
| 40 |
'speedtest1-wasmfs.mjs'+globalThis.location.search,{ |
| 41 |
type: 'module' |
| 42 |
}); |
| 43 |
log("Starting up..."); |
| 44 |
W.onmessage = function({data}){ |
| 45 |
switch(data.type){ |
| 46 |
case 'log': log(...data.args); break; |
| 47 |
case 'logErr': logErr(...data.args); break; |
| 48 |
default: |
| 49 |
break; |
| 50 |
} |
| 51 |
}; |
| 52 |
})(); |
| 53 |
</script> |
| 54 |
</body> |
| 55 |
</html> |