Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TcBinding

Class which acts as an abstraction layer between a TcSymbol and the TcCom layer. It is responsible for value conversion to Data and from it, as well as Type Checking, storing all the Memory location which must be read, how to execute clearing of a Symbol.

By itself, the TcBinding also acts as a Symbol Pointer, which is used for subscribing for change notifications

Lastly, it is also the EventEmitter for the TcSymbol

Hierarchy

Implements

Index

Constructors

constructor

  • new TcBinding(context: TcContext, symbol: TcSymbol, parent: TcEmitter, onSet?: undefined | string, onGet?: undefined | string, onClear?: undefined | string, onChange?: undefined | string, debug?: boolean): TcBinding
  • Constructor for a Binding with no information on memory location, but definition of its components and different parameters, used by derived classes

    Parameters

    • context: TcContext

      The TcContext which owns this binding

    • symbol: TcSymbol

      The TcSymbol which owns this binding

    • parent: TcEmitter

      Parent Emitter, to whom a event will be propagate to

    • Optional onSet: undefined | string

      Alias, which to use in place of 'set'

    • Optional onGet: undefined | string

      Alias, which to use in place of 'get'

    • Optional onClear: undefined | string

      Alias, which to use in place of 'cleared'

    • Optional onChange: undefined | string

      Alias, which to use in place of 'changed'

    • Default value debug: boolean = false

      If enabled, will produce debug information

    Returns TcBinding

Accessors

clearPackages

context

indexGroup

  • get indexGroup(): number

indexOffset

  • get indexOffset(): number

isValid

  • get isValid(): boolean

readOnly

  • get readOnly(): boolean
  • Flag, when if true, TcBinding is ReadOnly an no write operation can be invoked

    Returns boolean

readPackages

size

  • get size(): number

symbol

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

checkInput

  • checkInput(value: any): void

clear

  • clear(): Promise<void>

emit

  • emit(eventName: string | symbol, e: TcEvent): boolean
  • Emits an event of eventName with data e and if parent is present will propagated that event to it, unless stopped

    Parameters

    • eventName: string | symbol

      The event name to emit

    • e: TcEvent

      The Data associated with this event

    Returns boolean

    • True if the event had listeners, false otherwise.

emitChange

  • Emits a 'changed' event, unless it was aliased to a custom name

    Parameters

    • data: TcEvent

      The data, to pass along with the event

    Returns void

emitCleared

  • Emits a 'cleared' event, unless it was aliased to a custom name

    Parameters

    • data: TcEvent

      The data, to pass along with the event

    Returns void

emitGet

  • Emits a 'get' event, unless it was aliased to a custom name

    Parameters

    • data: TcEvent

      The data, to pass along with the event

    Returns void

emitSet

  • Emits a 'set' event, unless it was aliased to a custom name

    Parameters

    • data: TcEvent

      The data, to pass along with the event

    Returns void

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

Abstract fromRaw

getMaxListeners

  • getMaxListeners(): number

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: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

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

    • event: string | symbol

    Returns Function[]

read

  • read(): Promise<any>

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

subscribe

  • subscribe(sampling: number, callback: (value: any) => void): Promise<void>
  • Performs a subscription of this TcBinding for monitoring value change

    throws

    TcBindingIsInvalidException - Attempting operation on an invalidated TcBinding

    throws

    TcComIsInvalidException - Attempted to use an Invalid TcCom Object for subscription

    throws

    TcComSubscribeException - Failed to subscribe to the provided pointer

    Parameters

    • sampling: number

      The speed at which change is detected

    • callback: (value: any) => void

      Callback, which is invoked when a change does happened

        • (value: any): void
        • Parameters

          • value: any

          Returns void

    Returns Promise<void>

Abstract toRaw

unsubscribe

  • unsubscribe(): Promise<void>

write

  • write(value: any): Promise<any>

Static invalidate

  • Invalidates the provided TcBinding

    Parameters

    • binding: TcBinding

      The TcBinding, which is to be invalidated

    Returns void

Generated using TypeDoc