Class JDField

A Jacdac field.

Hierarchy

JDOM

eventStats: Record<string, number> = {}

Gets a counter of event emit calls.

Gets the parent JDOM member

newListenerStats: Record<string, number> = undefined

Gets a counter map from events to new listener counts

nodeId: number = ...

Gets an internal unique node identifier, mostly used for debugging.

  • get changeId(): number
  • Gets a counter for the CHANGE event.

    Returns number

  • get friendlyName(): string
  • Gets the JDOM friendly name

    Returns string

  • get id(): string
  • Gets the JDOM node identifier

    Returns string

  • get name(): string
  • Gets the JDOM name

    Returns string

  • get nodeData(): Record<string, unknown>
  • Gets a databag to store custom information

    Returns Record<string, unknown>

  • get nodeKind(): string
  • Gets FIELD_NODE_NAME

    Returns string

  • get qualifiedName(): string
  • Gets the JDOM qualified name

    Returns string

  • Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

    Parameters

    • eventName: string
    • Rest ...args: unknown[]

    Returns boolean

  • Emit event in current node and parent nodes

    Parameters

    • event: string

      event to emit

    • Optional arg: any

      event arguments

    Returns void

  • Gets the number of listeners for a given event

    Parameters

    • eventName: string

      name of the event

    Returns number

    number of registered handlers

  • Gets the list stack trace where an event was registered. Only enabled if Flags.debug is true.

    Parameters

    • eventName: string

      name of the event

    Returns string[]

    stack traces where a listener was added

  • Creates an observable from the given event

    Type Parameters

    • T

    Parameters

    • eventName: string | string[]

    Returns Observable<T>

  • Registers a handler for one or more events to run only once.

    Parameters

    • eventName: string | string[]

      name or names of the events to subscribe

    • handler: EventHandler

      handler to execute

    Returns JDField

    current object instance

  • Subscribes to an event and returns the unsubscription handler

    Type Parameters

    • T

    Parameters

    • eventName: string | string[]
    • next: ((value) => void)
        • (value): void
        • Parameters

          • value: T

          Returns void

    Returns (() => void)

      • (): void
      • Subscribes to an event and returns the unsubscription handler

        Returns void

        Category

        JDOM

Data

  • get unit(): Unit
  • Gets the unit of the data stored in the field

    Returns Unit

Other

  • Awaits an event with a timeout. Throws JacdacError with timeout if operation does not return.

    Parameters

    Returns Promise<void>

Specification

index: number

Gets the index in the unpacked data payload

specification: PacketMember

Gets the field specification

Generated using TypeDoc