0.6.0 • Published 5 years ago

anarchic-gui v0.6.0

Weekly downloads
33
License
-
Repository
github
Last release
5 years ago

Anarchic GUI

A Node and React Hyperchain GUI

Install

npm i anarchic-gui

Usage

app
├───node.js
└───browser.js
  • node.js

    const GUI = require('anarchic-gui/node')
    const { runDevServer, build, launch } = GUI({
      browser: require.resolve('./browser')
    })
    await build() // OR
    await runDevServer()
    // then
    launch()
  • browser.js

    const { render, h } = require('anarchic-gui/browser')
    render(() => {
      return h.div('Hello world!')
    })
node node.js

API

Node

const GUI = require('anarchic-gui/node')
const {...} = GUI(opts)
  • {...} Result of Carlo's carlo-webpack
  • opts

    • browser

      • entry [string] Webpack's entry file
      • globals [object] Entries made available as globals via Webpack's DefinePlugin
    • html [object] Options for html-webpack-plugin

    • webpack [object] Options for webpack.config

    • carlo [object] Options for Carlo

Browser

const { render, h } = require('anarchic-gui/browser')
render(() => {
  return h.div('Hello World!')
})
  • render [function] Function that takes a callback that should return an HTML or React(-like) Element which will be rendered in the Browser.

  • h [object] Hyperchain reviver instance.

const { H, h } = require('anarchic-gui/browser')
  • H [function] Hyperchain reviver function
  • h [object] An instance of H()
const { createElement } = require('anarchic-gui/browser')
  • createElement [function] React's createElement