Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
public workdir?: string,
) {
log.verbose('CacheStore', 'constructor(%s)', workdir)
workdir = workdir || '.flash-store-sync'
this.asyncBusyDict = {}
this.asyncBusyState = new StateSwitch(
'Busy:' + workdir.split('/').pop(), // get the latest folder name
log,
)
this.cacheMap = new Map()
this.flashStore = new FlashStore(workdir)
this.asyncBusyAdd(this.loadStoreToCache())
}
interface IoEventAny {
name: IoEventName,
payload: any,
}
type IoEvent = IoEventScan | IoEventAny
export class Io {
private readonly id : string
private readonly protocol : string
private eventBuffer : IoEvent[] = []
private ws : undefined | WebSocket
private readonly state = new StateSwitch('Io', log)
private reconnectTimer? : NodeJS.Timer
private reconnectTimeout? : number
private lifeTimer? : NodeJS.Timer
private onMessage: undefined | AnyFunction
private scanPayload?: PuppetQrcodeScanEvent
constructor (
private options: IoOptions,
) {
options.apihost = options.apihost || config.apihost
options.protocol = options.protocol || config.default.DEFAULT_PROTOCOL
constructor(
public options: ManagerOptions,
) {
super(options.endpoint, options.token)
log.verbose('PuppetPadchatManager', 'constructor()')
this.memorySlot = {
device: {},
}
this.state = new StateSwitch('PuppetPadchatManager')
/**
* Executer Queue: execute one task at a time,
* delay between them for 15 second
*/
this.delayQueueExecutor = new DelayQueueExector(1000 * 15)
}
constructor (
public options: IoClientOptions,
) {
log.verbose('IoClient', 'constructor(%s)', JSON.stringify(options))
this.state = new StateSwitch('IoClient', log)
this.io = new Io({
token : this.options.token,
wechaty : this.options.wechaty,
})
}