voodootikigod/node-serialport — pull request #66 by JayBeavers (2012-07-29 16:27:07+00:00)
Title: Proposed change to serialport ctor to add callback after open or fatal error

Change to the ctor api to add a 'completion callback'. This API change is backwards compatible with existing code.

This change optimizes the common case of waiting to start writing or reading from the SerialPort stream until it is open. It replaces the code:

var sp = new SerialPort(...);
sp.once('open', function() { doSomethingSerially... } );

with the more concise and understandable form:

var sp = new SerialPort(..., function() { doSomethingSerially... }_;