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.

Calling `close()` removes all event listeners (including "error")

See original GitHub issue

When a SerialPort is closed by calling close(), all event listeners are removed (as per the documentation). This behavior might be undesired.

If one calls write on a closed serial port connection without passing a callback to the write method, an “error” event is emitted by default. So, calling port.write(buf); on a closed serial port can cause an “error” event to be emitted without an “error” event handler (even if the user created an “error” event handler before the SerialPort was closed). In this case, the default Node behavior for this is to throw an exception, which could crash the program.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
reconbotcommented, Apr 25, 2016

fixed in 3.0.0

0reactions
reconbotcommented, Mar 28, 2016

Tracking in #702

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript removeEventListener not working - Stack Overflow
WARNING: I found out what was wrong with my approach. The removeEventListener() method ONLY works with NAMED FUNCTIONS. It does NOT work with...
Read more >
EventTarget.removeEventListener() - Web APIs | MDN
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.
Read more >
JavaScript: How to Add and Remove Event Listeners
You can remove an event listener using the removeEventListener() method. This method takes the same two arguments: the event type you are ...
Read more >
JavaScript Event Listeners Ultimate Guide
The removeEventListener function is a simple function that you can call on an element to remove an event listener that was previously added...
Read more >
JavaScript removeEventListener() method with examples
The Javascript removeEventListener() is an inbuilt function that is used to remove removes an event handler that was previously added using ...
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