ulambda/bootstrap/bootstrap.html

105 lines
3.0 KiB
HTML

<!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="prebirth.js"></script>
<script type="text/javascript" src="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', `./${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>