Created
September 20, 2020 12:39
-
-
Save y21/049bf9cf9238339a6ae4984a4a15eb55 to your computer and use it in GitHub Desktop.
Embedded console
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
// https://github.com/y21/embedded-console | |
import EmbeddedConsole from './EmbeddedConsole'; | |
import React from 'react'; | |
export default class Console extends React.Component { | |
state = {}; | |
componentDidMount() { | |
const element = document.getElementById('console'); | |
if (!element) return console.error('Console element not found'); | |
const ec = new EmbeddedConsole(element, { | |
height: '20%' | |
}); | |
this.setState({ console: ec }); | |
ec.log('Hello', 123); | |
// ... | |
} | |
render() { | |
return ( | |
<div id="console"></div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment