Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(config: number | string | IConfig) {
const parsedConfig = parseConfig(config);
super(parsedConfig.pin);
this.pullResistor = parsedConfig.pullResistor;
this._input = new Gpio(getPin(parsedConfig.pin, this.pins[0]), {
mode: Gpio.INPUT,
pullUpDown: parsedConfig.pullResistor
});
this._input.enableInterrupt(Gpio.EITHER_EDGE);
this._input.on('interrupt', (level: number) => setTimeout(() => {
this._currentValue = level;
this.emit('change', this.value);
}));
this._currentValue = this._input.digitalRead();
}