diffy-view

1.1.0 • Public • Published

Diffy View

A simple class to extend and make React like components for CLI

Example

const DiffyView = require("diffy-view")

class View extends DiffyView {
  render(){
    return `Enter your name
      ${this.state.name || ""}
    `
  }
}

const view = new View({state:{}})

view.on("enter-key",()=>{
 console.log("Enter key pressed")
  view.setState({
    name : this.state.input
  })
})

view.on("update",(line)=>{
  view.setState({
    input:line
  }) 
})

view.forceRender()

Credit

Diffy by Mafintosh

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i diffy-view

    Weekly Downloads

    1

    Version

    1.1.0

    License

    ISC

    Unpacked Size

    13.9 kB

    Total Files

    5

    Last publish

    Collaborators

    • rbndg