Created
October 17, 2016 17:31
-
-
Save ssube/cf9b50e81cdfe2a4bfd53399894b312f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component} from 'react'; | |
import blessed from 'blessed'; | |
export default class BoxComponent extends Component { | |
constructor(props, context) { | |
super(props, context); | |
this.node = blessed.box(props); | |
} | |
render() { | |
return this.node; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import blessed from 'blessed'; | |
import bunyan from 'bunyan'; | |
import React from 'react'; | |
import render from './render'; | |
import Box from './comp/Box'; | |
const log = bunyan.createLogger({ | |
level: 'debug', | |
name: 'react-test', | |
streams: [{ | |
path: './tmp/react-test.log' | |
}] | |
}); | |
function main(args) { | |
const screen = blessed.screen(); | |
render(<Box />, {log, screen}, () => { | |
log.info('render callback'); | |
screen.render(); | |
}); | |
} | |
main(process.argv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function render(element, {log, screen}, cb) { | |
screen.append(element.node); // <-- how do I get this? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment