cycle shell
A programmable web based shell-like interface
Installation
npm install cycle-shell
Usage
{ return input}
API
cycle(update, opts)
Initialize a cycle shell instance. By default, the cycle shell will be placed in the <body>
of the document.
Returns Process count listener
var counter = main
update
- type:
function
- An update function that gets run when the input box is submitted
opts
- type:
object
welcome
- type:
string
- A message to be displayed when the shell is first run
title
- type:
string
- The title of the game/application to be displayed next to the input box
view
- type:
function
- The return value from the
main
function gets run through the view function to produce a valid output.
The default view function is set up to handle objects, arrays, strings, numbers, and vdux components.
const defaultView = { if typeof output !== 'object' || outputprops return output else if output else return }
initialState
- type:
object
- set an initial state for the application
middleware
- type:
function || generator
- Connect custom middleware to cycle shell
out(msg)
Exposed out action for adding messages to the output log.
msg
- type:
string
- A message to be placed in the output log.