aboutsummaryrefslogtreecommitdiff
path: root/sketches/week-1/index.html
blob: 7c59b0e0ef785cfd73e334d9349d3717c43e1ac9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Gen bqn.js</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      pre#debug {
        word-wrap: break-word;
        white-space: pre-wrap;
        overflow: auto;
        background-color: #0f0c19;
        color: #fff;
        padding: 1rem;
      }
      canvas {
        border: 1px solid #000;
      }
    </style>
  </head>
  <body>
    <script src="./bqn.js"></script>
    <script>
      const debugNode = () => {
        const $debug = document.getElementById('debug') ?? document.createElement('pre')
        $debug.parentNode || document.body.appendChild($debug)
        $debug.id = 'debug'
        return $debug
      }
      const debug = (value) => {
        console.log(fmt(value))
        const $dbg = debugNode()
        $dbg.innerText = `${$dbg.innerText || '> start'}\n> ${fmt(value)}`
      }
    </script>
    <script src="./script.js"></script>
  </body>
</html>