viewnode

simple view engine, load once, render many times

Usage no npm install needed!

<script type="module">
  import viewnode from 'https://cdn.skypack.dev/viewnode';
</script>

README

viewnode

simple view engine, load once, render many times

demo

reference

<tag component="component" id?="id">
  if id exists, viewMap[id] will be available
</tag>

type ViewNode {
  node: HTMLElement
  name: string
}

type ViewMap {
  [key: string]: ViewNode
}

fn RenderOnceFunction(
    el: ViewNode,
    context: Object,
    render: RenderFunction,
    viewMap: ViewMap,
) -> UnloadFunction

fn RenderMultipleFunction(
    el: ViewNode,
    context: Object,
    render: RenderFunction,
    viewMap: ViewMap,
) -> ()

type ComponentMap {
  [name: string]: RenderOnceFunction | RenderMultipleFunction
}

fn LoadFunction() -> ()
fn RenderFunction() -> ()
fn UnloadFunction() -> ()

type App {
    load: LoadFunction,
    render: RenderFunction, 
    unload: UnloadFunction,
}

license

ISC