Skip to content

Instantly share code, notes, and snippets.

View benalbahari's full-sized avatar

Ben Albahari benalbahari

View GitHub Profile
@benalbahari
benalbahari / hyperapp-transpiled.js
Created November 25, 2017 15:14
hyperapp-transpiled.js
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function app(props, container) {
var lock;
var root = (container = container || document.body).children[0];
var node = vnode(root, [].map);
var lifecycle = [];
var appState = props.state || {};
var appActions = {};
@benalbahari
benalbahari / hyperapp.ts
Created November 25, 2017 15:12
hyperapp.ts
export function app<State, Actions> (props: AppProps<State, Actions>, container?: HTMLElement | null): Actions {
var lock: boolean
var root = (container = container || document.body).children[0]
var node = vnode(root, [].map)
var lifecycle : (() => void)[] = []
var appState: State = props.state || <State>{}
var appActions = <Actions>{}
repaint(init(appState, appActions, props.actions, []))