main.js
function RemoveDetector (detector) {
  let index = motionDetectors.indexOf(detector)
  log.info('Removing Detector...')
  if (index > -1) {
    em.GetEnvironment().unbindDetector(detector)
    motionDetectors.splice(index, 1)
    // Redundant: Motion detectors are also copied to environment!
    em.GetEnvironment().motionDetectors.splice(index, 1)
    return true
  } else {
    log.info(chalk.yellow(`Detector ${detector} not found, ignoring and returning false...`))
  }
  return false
}
function RemoveDetector (detector) {
  let index = motionDetectors.indexOf(detector)
  log.info('Removing Detector...')
  if (index > -1) {
    em.GetEnvironment().unbindDetector(detector)
    motionDetectors.splice(index, 1)
    // Redundant: Motion detectors are also copied to environment!
    em.GetEnvironment().motionDetectors.splice(index, 1)
    return true
  } else {
    log.info(chalk.yellow(`Detector ${detector} not found, ignoring and returning false...`))
  }
  return false
}
function RemoveDetector ( detector ) { let index = motionDetectors . indexOf ( detector ) log . info ( 'Removing Detector...' ) if ( index > - 1 ) { em . GetEnvironment ( ) . unbindDetector ( detector ) motionDetectors . splice ( index , 1 ) // Redundant: Motion detectors are also copied to environment! em . GetEnvironment ( ) . motionDetectors . splice ( index , 1 ) return true } else { log . info ( chalk . yellow ( ` ${ detector } ` ) ) } return false }
Removes an existing MotionDetector from the context, including its event listeners.
Does not fail if the detector is not found.
@param {object} detector is the MotionDetector instance to remove.
@returns true if the detector was found (and subsequently removed).
@public
Removes an existing MotionDetector from the context including its event listeners . Does not fail if the detector is not found .