question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"resize" event not working?

See original GitHub issue

I’m trying to get the resize event to work, or simply to get the new terminal height whenever it’s resized, but it’s not working so far.

I’ve narrowed it down to this simple script:

var term = require( 'terminal-kit' ).terminal ;

setInterval(function() {
	console.info(term.height);
}, 1000);

term.on('resize', function(width, height) {
	console.info('Resize: ' + width + ', ' + height);
});

This will continuously print the same size, even as I resize the terminal, and the “resize” event is never fired.

If I Ctrl+C the script and start it again, it will then pick up the new terminal size, so it’s getting it right but it just never updates once the script starts.

I’ve tried in ConEmu and the default Windows terminal, both under WSL and DOS but none of these are working. Any idea what could be the issue?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
cronvelcommented, Oct 20, 2017

@laurent22 @refack Thanks a lot, it will be really useful. I don’t have Windows anymore and I never used it for dev, so I terribly lack experience. And there are many specific environments like Cygwin and WSL, or various terminals more or less compliant (putty, console2, etc). I realize that there are more Node.js developers working on this platform than I could imagine, and I would be happy if they could fully enjoy the lib 😉

0reactions
refackcommented, Oct 20, 2017

If you need Windows specific review, feel free to ping me as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - resize event not triggered on div
I've attached an "resize" event listener on container div. After opening up dev tools, and modifying the width of container , resize callback ......
Read more >
Window: resize event - Web APIs | MDN
The resize event fires when the document view (window) has been resized. This event is not cancelable and does not bubble.
Read more >
How to Capture Browser Window Resize Event in JavaScript
Answer: Use the addEventListener() Method​​ You can simply use the addEventListener() method to register an event handler to listen for the browser window...
Read more >
How to wait resize end event and then perform an action ...
We want the “resize” event to only be fired once we are done resizing. Prerequisite: To solve this problem we use two functions:....
Read more >
onresize Event
Example. Execute a JavaScript when the browser window is resized: <body onresize="myFunction()">.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found