hyper-fun
fun way to build app with hyperscript and observable
What's this
With hyperscript and observable as core + render/diffing, we get a decent view layer for building web app. No compiler is needed. If you itch for using html templating instead of hyperscript you can substitute with htm.
observable is using my fork version which has non-breaking updated features that have slightly modern interface + hyperscript with event caching.
Usage
has a new option setting called useHook
. This's just synthetic sugar of the observable
; o const useState = o // now observable has array like interface when declaredconst state setState = // to make the observable behave like useReducer pass// a second argument as initial valueconst useReducer = o const state dispatch = // to make it behave like an effect, call it with a function// where it will pass the new value, whenever the value changes. // to stop being notifed of these changes, call the function that was returnedconst stop = // then some time later
A simple usage case
const state setState = const app =
Samples
run npm run todo
or npm run vdom
to see working sample
Extra
has a new interface called fun
. This basically an accessor for cleaner codes i.e
which has advantage when you want want to loop/compute observable value directly.
const fun } = o // original inteface { }// instead with accessoronclick: