summaryrefslogtreecommitdiffstats
path: root/ext/wasm/demo-123-worker.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
commit18657a960e125336f704ea058e25c27bd3900dcb (patch)
tree17b438b680ed45a996d7b59951e6aa34023783f2 /ext/wasm/demo-123-worker.html
parentInitial commit. (diff)
downloadsqlite3-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/demo-123-worker.html')
-rw-r--r--ext/wasm/demo-123-worker.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/ext/wasm/demo-123-worker.html b/ext/wasm/demo-123-worker.html
new file mode 100644
index 0000000..692203d
--- /dev/null
+++ b/ext/wasm/demo-123-worker.html
@@ -0,0 +1,44 @@
+<!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">
+ <title>Hello, sqlite3</title>
+ <style>
+ .warning, .error {color: red}
+ .error {background-color: yellow}
+ body {
+ display: flex;
+ flex-direction: column;
+ font-family: monospace;
+ white-space: break-spaces;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>1-2-sqlite3 worker demo</h1>
+ <script>(function(){
+ const logHtml = function(cssClass,...args){
+ const ln = document.createElement('div');
+ if(cssClass) ln.classList.add(cssClass);
+ ln.append(document.createTextNode(args.join(' ')));
+ document.body.append(ln);
+ };
+ const w = new Worker("demo-123.js?sqlite3.dir=jswasm"
+ /* Note the URL argument on that name. See
+ the notes in demo-123.js (search for
+ "importScripts") for why we need
+ that. */);
+ w.onmessage = function({data}){
+ switch(data.type){
+ case 'log':
+ logHtml(data.payload.cssClass, ...data.payload.args);
+ break;
+ default:
+ logHtml('error',"Unhandled message:",data.type);
+ };
+ };
+ })();</script>
+ </body>
+</html>