Artifact
a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed :
File
demo-123-worker.html
— part of check-in
[2d687fa966]
at
2022-10-19 07:58:07
on branch trunk
— Latest upstream demo-123 and js/wasm bits.
(user:
stephan
size: 1461)
0000: 3c 21 64 6f 63 74 79 70 65 20 68 74 6d 6c 3e 0a <!doctype html>.
0010: 3c 68 74 6d 6c 20 6c 61 6e 67 3d 22 65 6e 2d 75 <html lang="en-u
0020: 73 22 3e 0a 20 20 3c 68 65 61 64 3e 0a 20 20 20 s">. <head>.
0030: 20 3c 6d 65 74 61 20 63 68 61 72 73 65 74 3d 22 <meta charset="
0040: 75 74 66 2d 38 22 3e 0a 20 20 20 20 3c 6d 65 74 utf-8">. <met
0050: 61 20 68 74 74 70 2d 65 71 75 69 76 3d 22 43 6f a http-equiv="Co
0060: 6e 74 65 6e 74 2d 54 79 70 65 22 20 63 6f 6e 74 ntent-Type" cont
0070: 65 6e 74 3d 22 74 65 78 74 2f 68 74 6d 6c 3b 20 ent="text/html;
0080: 63 68 61 72 73 65 74 3d 75 74 66 2d 38 22 3e 0a charset=utf-8">.
0090: 20 20 20 20 3c 6c 69 6e 6b 20 72 65 6c 3d 22 73 <link rel="s
00a0: 68 6f 72 74 63 75 74 20 69 63 6f 6e 22 20 68 72 hortcut icon" hr
00b0: 65 66 3d 22 64 61 74 61 3a 69 6d 61 67 65 2f 78 ef="data:image/x
00c0: 2d 69 63 6f 6e 3b 2c 22 20 74 79 70 65 3d 22 69 -icon;," type="i
00d0: 6d 61 67 65 2f 78 2d 69 63 6f 6e 22 3e 0a 20 20 mage/x-icon">.
00e0: 20 20 3c 74 69 74 6c 65 3e 48 65 6c 6c 6f 2c 20 <title>Hello,
00f0: 73 71 6c 69 74 65 33 3c 2f 74 69 74 6c 65 3e 0a sqlite3</title>.
0100: 20 20 20 20 3c 73 74 79 6c 65 3e 0a 20 20 20 20 <style>.
0110: 20 20 2e 77 61 72 6e 69 6e 67 2c 20 2e 65 72 72 .warning, .err
0120: 6f 72 20 7b 63 6f 6c 6f 72 3a 20 72 65 64 7d 0a or {color: red}.
0130: 20 20 20 20 20 20 2e 65 72 72 6f 72 20 7b 62 61 .error {ba
0140: 63 6b 67 72 6f 75 6e 64 2d 63 6f 6c 6f 72 3a 20 ckground-color:
0150: 79 65 6c 6c 6f 77 7d 0a 20 20 20 20 20 20 62 6f yellow}. bo
0160: 64 79 20 7b 0a 20 20 20 20 20 20 20 20 20 20 64 dy {. d
0170: 69 73 70 6c 61 79 3a 20 66 6c 65 78 3b 0a 20 20 isplay: flex;.
0180: 20 20 20 20 20 20 20 20 66 6c 65 78 2d 64 69 72 flex-dir
0190: 65 63 74 69 6f 6e 3a 20 63 6f 6c 75 6d 6e 3b 0a ection: column;.
01a0: 20 20 20 20 20 20 20 20 20 20 66 6f 6e 74 2d 66 font-f
01b0: 61 6d 69 6c 79 3a 20 6d 6f 6e 6f 73 70 61 63 65 amily: monospace
01c0: 3b 0a 20 20 20 20 20 20 20 20 20 20 77 68 69 74 ;. whit
01d0: 65 2d 73 70 61 63 65 3a 20 62 72 65 61 6b 2d 73 e-space: break-s
01e0: 70 61 63 65 73 3b 0a 20 20 20 20 20 20 7d 0a 20 paces;. }.
01f0: 20 20 20 3c 2f 73 74 79 6c 65 3e 0a 20 20 3c 2f </style>. </
0200: 68 65 61 64 3e 0a 20 20 3c 62 6f 64 79 3e 0a 20 head>. <body>.
0210: 20 20 20 3c 68 31 3e 31 2d 32 2d 73 71 6c 69 74 <h1>1-2-sqlit
0220: 65 33 20 77 6f 72 6b 65 72 20 64 65 6d 6f 3c 2f e3 worker demo</
0230: 68 31 3e 0a 20 20 20 20 3c 73 63 72 69 70 74 3e h1>. <script>
0240: 28 66 75 6e 63 74 69 6f 6e 28 29 7b 0a 20 20 20 (function(){.
0250: 20 20 20 63 6f 6e 73 74 20 6c 6f 67 48 74 6d 6c const logHtml
0260: 20 3d 20 66 75 6e 63 74 69 6f 6e 28 63 73 73 43 = function(cssC
0270: 6c 61 73 73 2c 2e 2e 2e 61 72 67 73 29 7b 0a 20 lass,...args){.
0280: 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6c 6e 20 const ln
0290: 3d 20 64 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 = document.creat
02a0: 65 45 6c 65 6d 65 6e 74 28 27 64 69 76 27 29 3b eElement('div');
02b0: 0a 20 20 20 20 20 20 20 20 69 66 28 63 73 73 43 . if(cssC
02c0: 6c 61 73 73 29 20 6c 6e 2e 63 6c 61 73 73 4c 69 lass) ln.classLi
02d0: 73 74 2e 61 64 64 28 63 73 73 43 6c 61 73 73 29 st.add(cssClass)
02e0: 3b 0a 20 20 20 20 20 20 20 20 6c 6e 2e 61 70 70 ;. ln.app
02f0: 65 6e 64 28 64 6f 63 75 6d 65 6e 74 2e 63 72 65 end(document.cre
0300: 61 74 65 54 65 78 74 4e 6f 64 65 28 61 72 67 73 ateTextNode(args
0310: 2e 6a 6f 69 6e 28 27 20 27 29 29 29 3b 0a 20 20 .join(' ')));.
0320: 20 20 20 20 20 20 64 6f 63 75 6d 65 6e 74 2e 62 document.b
0330: 6f 64 79 2e 61 70 70 65 6e 64 28 6c 6e 29 3b 0a ody.append(ln);.
0340: 20 20 20 20 20 20 7d 3b 0a 20 20 20 20 20 20 63 };. c
0350: 6f 6e 73 74 20 77 20 3d 20 6e 65 77 20 57 6f 72 onst w = new Wor
0360: 6b 65 72 28 22 64 65 6d 6f 2d 31 32 33 2e 6a 73 ker("demo-123.js
0370: 3f 73 71 6c 69 74 65 33 2e 64 69 72 3d 6a 73 77 ?sqlite3.dir=jsw
0380: 61 73 6d 22 0a 20 20 20 20 20 20 20 20 20 20 20 asm".
0390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
03a0: 2f 2a 20 4e 6f 74 65 20 74 68 65 20 55 52 4c 20 /* Note the URL
03b0: 61 72 67 75 6d 65 6e 74 20 6f 6e 20 74 68 61 74 argument on that
03c0: 20 6e 61 6d 65 2e 20 53 65 65 0a 20 20 20 20 20 name. See.
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
03e0: 20 20 20 20 20 20 20 20 20 74 68 65 20 6e 6f 74 the not
03f0: 65 73 20 69 6e 20 64 65 6d 6f 2d 31 32 33 2e 6a es in demo-123.j
0400: 73 20 28 73 65 61 72 63 68 20 66 6f 72 0a 20 20 s (search for.
0410: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0420: 20 20 20 20 20 20 20 20 20 20 20 20 22 69 6d 70 "imp
0430: 6f 72 74 53 63 72 69 70 74 73 22 29 20 66 6f 72 ortScripts") for
0440: 20 77 68 79 20 77 65 20 6e 65 65 64 0a 20 20 20 why we need.
0450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0460: 20 20 20 20 20 20 20 20 20 20 20 74 68 61 74 2e that.
0470: 20 2a 2f 29 3b 0a 20 20 20 20 20 20 77 2e 6f 6e */);. w.on
0480: 6d 65 73 73 61 67 65 20 3d 20 66 75 6e 63 74 69 message = functi
0490: 6f 6e 28 7b 64 61 74 61 7d 29 7b 0a 20 20 20 20 on({data}){.
04a0: 20 20 20 20 73 77 69 74 63 68 28 64 61 74 61 2e switch(data.
04b0: 74 79 70 65 29 7b 0a 20 20 20 20 20 20 20 20 20 type){.
04c0: 20 20 20 63 61 73 65 20 27 6c 6f 67 27 3a 0a 20 case 'log':.
04d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 6c 6f 67 log
04e0: 48 74 6d 6c 28 64 61 74 61 2e 70 61 79 6c 6f 61 Html(data.payloa
04f0: 64 2e 63 73 73 43 6c 61 73 73 2c 20 2e 2e 2e 64 d.cssClass, ...d
0500: 61 74 61 2e 70 61 79 6c 6f 61 64 2e 61 72 67 73 ata.payload.args
0510: 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 );.
0520: 20 62 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 break;.
0530: 20 20 20 20 64 65 66 61 75 6c 74 3a 0a 20 20 20 default:.
0540: 20 20 20 20 20 20 20 20 20 20 20 6c 6f 67 48 74 logHt
0550: 6d 6c 28 27 65 72 72 6f 72 27 2c 22 55 6e 68 61 ml('error',"Unha
0560: 6e 64 6c 65 64 20 6d 65 73 73 61 67 65 3a 22 2c ndled message:",
0570: 64 61 74 61 2e 74 79 70 65 29 3b 0a 20 20 20 20 data.type);.
0580: 20 20 20 20 7d 3b 0a 20 20 20 20 20 20 7d 3b 0a };. };.
0590: 20 20 20 20 7d 29 28 29 3b 3c 2f 73 63 72 69 70 })();</scrip
05a0: 74 3e 0a 20 20 3c 2f 62 6f 64 79 3e 0a 3c 2f 68 t>. </body>.</h
05b0: 74 6d 6c 3e 0a tml>.