index.js
function Capture (deviceIndex, displayMode, pixelFormat) {
  this.deviceIndex = deviceIndex;
  this.displayMode = displayMode;
  this.pixelFormat = pixelFormat;
  this.emergencyBrake = null;
  if (arguments.length !== 3 || typeof deviceIndex !== 'number' ||
      typeof displayMode !== 'number' || typeof pixelFormat !== 'number' ) {
    this.emit('error', new Error('Capture requires three number arguments: ' +
      'device index, display mode and pixel format'));
  } else {
    this.capture = macadamNative.capture({
      deviceIndex: deviceIndex,
      displayMode: displayMode,
      pixelFormat: pixelFormat
    });//.catch(err => { this.emit('error', err); });
    this.capture.then(x => { this.emergencyBrake = x; });
    this.running = true;
    /* process.on('exit', function () {
      console.log('Exiting node.');
      if (this.emergencyBrake) this.emergencyBrake.stop();
      this.emergencyBrake = null;
      process.exit(0);
    }); */
    process.on('SIGINT', () => {
      console.log('Received SIGINT.');
      if (this.emergencyBrake) this.emergencyBrake.stop();
      this.emergencyBrake = null;
      this.running = false;
      process.exit();
    });
    EventEmitter.call(this);
  }
}
function Capture (deviceIndex, displayMode, pixelFormat) {
  this.deviceIndex = deviceIndex;
  this.displayMode = displayMode;
  this.pixelFormat = pixelFormat;
  this.emergencyBrake = null;
  if (arguments.length !== 3 || typeof deviceIndex !== 'number' ||
      typeof displayMode !== 'number' || typeof pixelFormat !== 'number' ) {
    this.emit('error', new Error('Capture requires three number arguments: ' +
      'device index, display mode and pixel format'));
  } else {
    this.capture = macadamNative.capture({
      deviceIndex: deviceIndex,
      displayMode: displayMode,
      pixelFormat: pixelFormat
    });//.catch(err => { this.emit('error', err); });
    this.capture.then(x => { this.emergencyBrake = x; });
    this.running = true;
    /* process.on('exit', function () {
      console.log('Exiting node.');
      if (this.emergencyBrake) this.emergencyBrake.stop();
      this.emergencyBrake = null;
      process.exit(0);
    }); */
    process.on('SIGINT', () => {
      console.log('Received SIGINT.');
      if (this.emergencyBrake) this.emergencyBrake.stop();
      this.emergencyBrake = null;
      this.running = false;
      process.exit();
    });
    EventEmitter.call(this);
  }
}
function Capture ( deviceIndex , displayMode , pixelFormat ) { this . deviceIndex = deviceIndex ; this . displayMode = displayMode ; this . pixelFormat = pixelFormat ; this . emergencyBrake = null ; if ( arguments . length !== 3 || typeof deviceIndex !== 'number' || typeof displayMode !== 'number' || typeof pixelFormat !== 'number' ) { this . emit ( 'error' , new Error ( 'Capture requires three number arguments: ' + 'device index, display mode and pixel format' ) ) ; } else { this . capture = macadamNative . capture ( { deviceIndex : deviceIndex , displayMode : displayMode , pixelFormat : pixelFormat } ) ; //.catch(err => { this.emit('error', err); }); this . capture . then ( x => { this . emergencyBrake = x ; } ) ; this . running = true ; /* process.on('exit', function () {
      console.log('Exiting node.');
      if (this.emergencyBrake) this.emergencyBrake.stop();
      this.emergencyBrake = null;
      process.exit(0);
    }); */ process . on ( 'SIGINT' , ( ) => { console . log ( 'Received SIGINT.' ) ; if ( this . emergencyBrake ) this . emergencyBrake . stop ( ) ; this . emergencyBrake = null ; this . running = false ; process . exit ( ) ; } ) ; EventEmitter . call ( this ) ; } }
Capture class is deprecated
Capture class is deprecated