Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
blob: 2fc3007594795131fe947ea16a61cf7f57048c50 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<!--
  Copyright (C) 2017 Mike Gerwitz

  This file is part of Ulambda Scheme.

  Ulambda Scheme is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<html>
  <head>
    <meta charset="utf-8" />
    <title>Ulambda Scheme Browserstrap</title>
    <style type="text/css">
      * {
        font-family: monospace;
      }

      button#start {
        display: inline-block;
        border: 0px solid black;
        background-color: transparent;
        margin-left: 10ex;
      }
    </style>
  </head>
  <body>
    <h1>Ulambda Scheme Bootstrap</h1>

    <pre id="log">
This is the in-browser version of the bootstrap process; it operates
no differently than when invoked from the command-line, and has the
benefit of being able to be run without any further dependencies
(CLI requires Node.js, which is a hefty dependency.)

You do need a browser that supports ECMAScript 2015 or later, though.

Seeing as how it is rather rude to begin hammering your CPU when you
first load a page (as virtually every site you visit does now-a-days),
I'll wait for you to click the button below to get started.

</pre>

    <button id="start">| ... just a sec ... |</button>

    <noscript>
      <p>
        <strong>Bootstrapping requires JavaScript.</strong>
        All of Ulambda requires JavaScript, actually.
      </p>
    </noscript>

    <script type="text/javascript" src="bootstrap/prebirth.js"></script>
    <script type="text/javascript" src="bootstrap/Bootstrap.js"></script>

    <script type="text/javascript">
      const loge = document.getElementById( 'log' );
      const logf = ( str, e ) =>
      {
          loge.innerText += str + "\n";
          console.log( str );

          if ( e instanceof Error ) {
              console.error( e );
          }
      };

      const getf = path => new Promise( ( resolve, reject ) =>
      {
          const xhr = new XMLHttpRequest();

          xhr.responseType = 'text';
          xhr.open( 'GET', `bootstrap/${path}`, true );

          xhr.onload  = result => resolve( result.target.responseText );
          xhr.onerror = e => reject( e );

          xhr.send();
      } );

      const strap = new Bootstrap( getf, logf, new Prebirth() );

      const start = document.getElementById( 'start' );

      start.addEventListener( 'click', ev =>
      {
          ev.target.parentElement.removeChild( ev.target );
          strap.bootstrap();
      } );

      start.innerText = '| Start Bootstrapping! |';
    </script>
  </body>
</html>