Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const debug = require('debug')
const logger = debug('serialport/bindings/poller')
const EventEmitter = require('events')
const PollerBindings = require('bindings')('bindings.node').Poller
const EVENTS = {
UV_READABLE: 0b0001,
UV_WRITABLE: 0b0010,
UV_DISCONNECT: 0b0100,
}
function handleEvent(error, eventFlag) {
if (error) {
logger('error', error)
this.emit('readable', error)
this.emit('writable', error)
this.emit('disconnect', error)
return
}
if (eventFlag & EVENTS.UV_READABLE) {
const debug = require('debug')
const logger = debug('serialport/bindings/poller')
const EventEmitter = require('events')
const FDPoller = require('bindings')('bindings.node').Poller
const EVENTS = {
UV_READABLE: 1,
UV_WRITABLE: 2,
UV_DISCONNECT: 4,
}
function handleEvent(error, eventFlag) {
if (error) {
logger('error', error)
this.emit('readable', error)
this.emit('writable', error)
this.emit('disconnect', error)
return
}
if (eventFlag & EVENTS.UV_READABLE) {