nhg
is basically just mercury but without mercury. If you've ever read the source code for mercury (which you should, it's very short) you can see that it is basically a collection of independant modules and some glue code.
This repository breaks out those modules into their own files for browserify
efficiency and uses the modularized versions of the glue code (largely thanks to Ben Drucker). This repository contains no actual code, this is just for npm convenience.
npm install nhg
'use strict';
var document = require('nhg/document');
var h = require('nhg/h');
var State = require('nhg/state');
var Value = require('nhg/value');
var Send = require('nhg/send');
var RunApp = require('nhg/app');
function App() {
return State({
value: Value(0),
channels: {
clicks: incrementCounter
}
});
}
function incrementCounter(state) {
state.value.set(state.value() + 1);
}
App.render = function render(state) {
return h('div.counter', [
'The state ', h('code', 'clickCount'),
' has value: ' + state.value + '.', h('input.button', {
type: 'button',
value: 'Click me!',
'ev-click': Send(state.channels.clicks)
})
]);
};
RunApp(document.body, App(), App.render);
Module: main-loop-app
Module: observ-array
Module: value-event/base-event
Module: observ/computed
Module: virtual-dom/create-element
Module: dom-delegator
Module: virtual-dom/diff
Module: global/document
Module: weakmap-event
Module: virtual-dom/h
Module: main-loop
Module: vdom-thunk
Module: virtual-dom/patch
Module: sour
Module: value-event/change
Module: value-event/click
Module: value-event/value
Module: value-event/key
Module: value-event/submit
Module: value-event/event
Module: dover
Module: observ-struct
Module: virtual-dom/virtual-hyperscript/svg
Module: observ
Module: observ-varhash
Module: observ/watch
Module: global/window
Do not contribute code to this repository, create or update modules it depends on and make PR's to update the dependency.
npm run test
MIT