<form action="httpl://helloworld.ui" onchange="patch">
<div>
<p>First name: <input name="firstName" /></p>
<p>Last name: <input name="lastName" /></p>
</div>
<output name="out"><h2>Hello, {{firstName}} {{lastName}}!</h2></output>
</form>
// HATEOAS | |
// if it's going to be the engine of application state........ | |
// simple example | |
// ============== | |
var localStorage = link('httpl://localstorage.api'); | |
var settings = localStorage.collection('settings'); | |
settings.record('user').get(function(user) { | |
//... | |
}); |
It pains me to write this, because I prefer the more robust, function-composition-focused features of Javascript, but there's a threshold of performance where speed overrides elegance. After all, performance is half the reason that programming is skilled labor. So here we have it-- my list of performance benchmarks and advice.
Try/Catch Performance may be pitting try/catch against an easy-to-optimize opponent, but it still makes a strong case.
2012/02/24 pfraze
Making meaningful interactions between distributed networks is an interesting problem. There are a couple existing projects, including shared protocols like tent.io, and shared software like diaspora. Local is focused on an approach that hasn't received a lot of attention yet: the browser's program model.
<!DOCTYPE HSML> | |
<hsml> | |
<environment> | |
<!-- primitives --> | |
<camera type="perspective"></camera> | |
<plane edges="8"> | |
<surface><h1>An octogon</h1></surface> |
<!DOCTYPE HSML> | |
<hsml> | |
<environment> | |
<!-- complex shapes --> | |
<cube style="texture-color: rgba(255,255,255,0.5)"> | |
<surface orient="bottom"> | |
<pyramid sides="4" style="direction: 0,-1,0; texture-color: rgba(255,0,0,1.0); scale: 0.75%"> | |
<surface> | |
this pyramid is inside the half-translucent cube |
function ConfigServer() { | |
Environment.Server.call(this); | |
this.schemas = {}; | |
this.values = {}; | |
this.validators = {}; | |
this.broadcasters = {}; | |
var loc = window.location.pathname; | |
if (loc == '/') loc = '/index.html'; | |
this.configNamespace = 'config'+(loc.replace(/\/|\./g,'_')); |
Grim = (typeof Grim == 'undefined') ? {} : Grim; | |
(function(exports) { | |
// App Server | |
// ============ | |
// EXPORTED | |
// an isolated region of the DOM | |
function AppServer(id) { | |
Environment.Server.call(this); | |
this.serversBroadcast = Link.broadcaster(); |
When I started on Local, it wasn't clear what all was needed -- originally, it was just the LinkJS project. Then I had to make a Worker manager: MyHouse. Then I had to create client behaviors: CommonClient. Not to mention the promises lib and the couple of prototypes that Local added under the Environment
namespace. So now, here's a quick overview of what's getting used in a Local deployment:
Local.Promise // yeah, the ONE thing under the Local namespace. Brilliant.
Link.dispatch()
Link.subscribe()
Link.Navigator
Link.Router
Link.Responder
Link.Headerer // it...helps you build response headers
// persona.js | |
// user-session controls using mozilla's persona | |
// current user (likely an email) | |
Environment.user = null; | |
// Widgets | |
// ======= | |
// "log in / <username> log out" | |
function addPersonaCtrls(elem) { |