lib/index.js
function InputEvent(device, options){
  var self = this;
  EventEmitter.call(this);
  if(device instanceof InputEvent){
    device = device.device;
  }
  this.device  = device;
  this.options = options || { flags: 'r', encoding: null };
  this.options.fd = fs.openSync(this.device, this.options.flags);
  this.fd = fs.createReadStream(null, this.options);
  this.fd.on('data', function(data){
    self.emit('raw', data);
    self.process(data);
  });
  this.fd.on('error', function(err){
    self.emit('error', err);
  });
}
function InputEvent(device, options){
  var self = this;
  EventEmitter.call(this);
  if(device instanceof InputEvent){
    device = device.device;
  }
  this.device  = device;
  this.options = options || { flags: 'r', encoding: null };
  this.options.fd = fs.openSync(this.device, this.options.flags);
  this.fd = fs.createReadStream(null, this.options);
  this.fd.on('data', function(data){
    self.emit('raw', data);
    self.process(data);
  });
  this.fd.on('error', function(err){
    self.emit('error', err);
  });
}
function InputEvent ( device , options ) { var self = this ; EventEmitter . call ( this ) ; if ( device instanceof InputEvent ) { device = device . device ; } this . device = device ; this . options = options || { flags : 'r' , encoding : null } ; this . options . fd = fs . openSync ( this . device , this . options . flags ) ; this . fd = fs . createReadStream ( null , this . options ) ; this . fd . on ( 'data' , function ( data ) { self . emit ( 'raw' , data ) ; self . process ( data ) ; } ) ; this . fd . on ( 'error' , function ( err ) { self . emit ( 'error' , err ) ; } ) ; }
InputEvent
InputEvent