diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
commit | 18657a960e125336f704ea058e25c27bd3900dcb (patch) | |
tree | 17b438b680ed45a996d7b59951e6aa34023783f2 /ext/wasm/tester1-worker.html | |
parent | Initial commit. (diff) | |
download | sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.tar.xz sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.zip |
Adding upstream version 3.40.1.upstream/3.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/wasm/tester1-worker.html')
-rw-r--r-- | ext/wasm/tester1-worker.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/ext/wasm/tester1-worker.html b/ext/wasm/tester1-worker.html new file mode 100644 index 0000000..4d2df0c --- /dev/null +++ b/ext/wasm/tester1-worker.html @@ -0,0 +1,63 @@ +<!doctype html> +<html lang="en-us"> + <head> + <meta charset="utf-8"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> + <link rel="stylesheet" href="../common/emscripten.css"/> + <link rel="stylesheet" href="../common/testing.css"/> + <title>sqlite3 tester #1 (Worker thread)</title> + <style> + body { + font-family: monospace; + } + </style> + </head> + <body> + <h1 id='color-target'>sqlite3 WASM/JS tester #1 (Worker thread)</h1> + <div>See <a href='tester1.html' target='tester1.html'>tester1.html</a> + for the UI-thread variant.</div> + <div class='input-wrapper'> + <input type='checkbox' id='cb-log-reverse'> + <label for='cb-log-reverse'>Reverse log order?</label> + </div> + <div id='test-output'></div> + <script>(function(){ + const logTarget = document.querySelector('#test-output'); + const logHtml = function(cssClass,...args){ + const ln = document.createElement('div'); + if(cssClass){ + for(const c of (Array.isArray(cssClass) ? cssClass : [cssClass])){ + ln.classList.add(c); + } + } + ln.append(document.createTextNode(args.join(' '))); + logTarget.append(ln); + }; + const cbReverse = document.querySelector('#cb-log-reverse'); + const cbReverseIt = ()=>{ + logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse'); + }; + cbReverse.addEventListener('change',cbReverseIt,true); + cbReverseIt(); + const w = new Worker("tester1.js?sqlite3.dir=jswasm"); + w.onmessage = function({data}){ + switch(data.type){ + case 'log': + logHtml(data.payload.cssClass, ...data.payload.args); + break; + case 'error': + logHtml('error', ...data.payload.args); + break; + case 'test-result': + document.querySelector('#color-target').classList.add( + data.payload.pass ? 'tests-pass' : 'tests-fail' + ); + break; + default: + logHtml('error',"Unhandled message:",data.type); + }; + }; + })();</script> + </body> +</html> |