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    <title>Hello, sqlite3</title>
8    <style>
9      .warning, .error {color: red}
10      .error {background-color: yellow}
11      body {
12          display: flex;
13          flex-direction: column;
14          font-family: monospace;
15          white-space: break-spaces;
16      }
17    </style>
18  </head>
19  <body>
20    <h1>1-2-sqlite3 worker demo</h1>
21    <script>(function(){
22      const logHtml = function(cssClass,...args){
23        const ln = document.createElement('div');
24        if(cssClass) ln.classList.add(cssClass);
25        ln.append(document.createTextNode(args.join(' ')));
26        document.body.append(ln);
27      };
28      const w = new Worker("demo-123.js");
29      w.onmessage = function({data}){
30        switch(data.type){
31            case 'log':
32              logHtml(data.payload.cssClass, ...data.payload.args);
33              break;
34            default:
35              logHtml('error',"Unhandled message:",data.type);
36        };
37      };
38    })();</script>
39  </body>
40</html>
41