DAVE'S LIFE ON HOLD

A New Kind Of Web Framework

One of the projects I work on every night is an attempt to build an implementation of Self in JavaScript. Right now most of this effort is located at the Self.js git repo, where in I have two main files self.js and html.js. The first of these, self.js, creates a set of extensions to the base language in order to support having function objects that perform dynamic dispatch upon their arguments. The second, html.js, builds a basic web framework using the extension from the first.

To get an idea of how far off the beaten path this code is, let's build a button and put it on the page:

button = HTML('element:','button')('contains:','test button')('style:', position:'absolute', border: 0, color: 'white', background: 'darkgreen')('on:','click','e| console.log(this); console.log(e)')('to:',200,100)

If you load up the blank page in the iframe below you'll see it in action:



It works by creating a Self-ish object that has a read/write able slot to contain an HTMLElement and a set of 5 methods that provide styling, positioning, content setting, creation, and event handling:



This combination turns out to be all you need to build rather complicated web applications.