Calling `close()` removes all event listeners (including "error")
See original GitHub issueWhen 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:
- Created 8 years ago
- Comments:5 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fixed in 3.0.0
Tracking in #702