Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DriverCoreIO

Core abstract class of Driver. Responsible of handling base write operations and read operations.

Hierarchy

Implements

Index

Properties

currentSize

currentSize: object

Type declaration

  • columns: number
  • rows: number

destroyed

destroyed: boolean

options

options: DriverOptions

Configuration options of the current instance. Driver is configured on start but options can be changed later while is running.

sleep

sleep: function

Type declaration

    • (ms: number): Promise<this>
    • Parameters

      • ms: number

      Returns Promise<this>

started

started: boolean

time

time: function

Type declaration

    • (ms: number): Promise<this>
    • Parameters

      • ms: number

      Returns Promise<this>

Static ERROR_ERROR_PUSHED_WAS_NEVER_TRUE

ERROR_ERROR_PUSHED_WAS_NEVER_TRUE: string

Static ERROR_TYPE

ERROR_TYPE: "cli-driver-error"

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

cleanData

  • cleanData(): this
  • Cleans the data buffer. Useful for making sure that the next data chunk is independent from current state.

    Returns this

destroy

  • destroy(): Promise<this>
  • destroy current terminal

    Returns Promise<this>

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

enter

  • enter(input?: string, waitAfterEnter?: number): Promise<void>
  • Will write given text and then press ENTER. Just like write but appending '\r'

    Parameters

    • Optional input: string

      the string to enter

    • Optional waitAfterEnter: number

    Returns Promise<void>

eventNames

getAllData

  • getAllData(): Promise<string>
  • get all the data collected from start

    Returns Promise<string>

getCommandHistory

  • getCommandHistory(): Promise<Array<any>>
  • get information about all commands run in this driver instance. Will only work when options.debug===true

    Returns Promise<Array<any>>

getCurrentSize

  • getCurrentSize(): object
  • Returns object

    • columns: number
    • rows: number

getDataFromLastWrite

  • getDataFromLastWrite(lastWrite?: number): string
  • Get data from last time write was issued. Remember that other methods like enter could also end up calling write

    Parameters

    • Optional lastWrite: number

      Optional get data from given time

    Returns string

getDataFromTimestamp

  • getDataFromTimestamp(timestamp: number): string
  • Get data printed after given timestamp

    Parameters

    • timestamp: number

    Returns string

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getStrippedDataFromLastWrite

  • getStrippedDataFromLastWrite(lastWrite?: number): string
  • same as getDataFromLastWrite but applying strip.

    Parameters

    • Optional lastWrite: number

      Optional get data from given time

    Returns string

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

resize

  • resize(columns: number, rows: number): Promise<this>
  • Resizes the dimensions of the pty.

    Parameters

    • columns: number

      THe number of columns to use.

    • rows: number

      The number of rows to use.

    Returns Promise<this>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

start

  • Starts the client with given options. Will spawn a new terminal

    Parameters

    Returns Promise<this>

strip

  • strip(s: string): string

waitTime

  • waitTime(ms: number): Promise<this>
  • Return a promise resolved after given number of milliseconds

    Parameters

    • ms: number

      will resolve the promise only when given number of milliseconds passed

    Returns Promise<this>

write

  • write(input?: string, waitAfterWrite?: number): Promise<void>
  • Writes given text in the terminal

    Parameters

    • Optional input: string
    • Optional waitAfterWrite: number

      number of milliseconds after which resolve write / enter promise. Default: 0

    Returns Promise<void>

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static systemIsWindows

  • systemIsWindows(): boolean

Generated using TypeDoc