Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting width and height of viewport? #105

Open
ThariqS opened this issue Mar 2, 2019 · 2 comments
Open

Getting width and height of viewport? #105

ThariqS opened this issue Mar 2, 2019 · 2 comments

Comments

@ThariqS
Copy link

ThariqS commented Mar 2, 2019

If I want to create a line that crosses the entire width of the terminal or fill half of the lines of the terminal with logs, I have no way (from what I can find) of finding the overall width/height of the console. Is there a way, if not, can it the width/height be passed down as props to the top level component?

@zamotany
Copy link
Owner

zamotany commented Mar 3, 2019

Doesn't process.stdout.columns and process.stdout.rows work for you? process.stdout is a TTY stream so you should be able to get width (columns) and height (rows) of the terminal (https://nodejs.org/api/tty.html)

@ThariqS
Copy link
Author

ThariqS commented Mar 3, 2019

ah I didn't know that was a thing, thank you. It might be useful to have as a wrapper or documented somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants