Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StatusLog

Visual representation of alerts like connection failures.

Usually wired to a <div id="databench-alerts"> element.

Hierarchy

Index

Constructors

constructor

  • new StatusLog(node: HTMLElement, formatter?: function): StatusLog
  • Parameters

    • node: HTMLElement

      HTML node.

    • Default value formatter: function = StatusLog.defaultAlert

      Formats a message and a count to a string.

        • (message: string, count: number): string
        • Parameters

          • message: string
          • count: number

          Returns string

    Returns StatusLog

Properties

_messages

_messages: object

Type declaration

  • [message: string]: number

actionName

actionName: string

formatter

formatter: function

Type declaration

    • (message: string, count: number): string
    • Parameters

      • message: string
      • count: number

      Returns string

idCount

idCount: number

node

wireSignal

wireSignal: string | object

Static idCounter

idCounter: number = 0

Methods

actionFormat

  • actionFormat(value: any): any
  • Formats the payload of an action.

    Parameters

    • value: any

      Original payload.

    Returns any

    Modified payload.

add

determineActionName

  • determineActionName(node: HTMLElement): string
  • Determine the name of the action that should be associated with the node.

    The action name is determined from the tag's data-action, name or id attribute (in that order).

    Parameters

    • node: HTMLElement

      A HTML element.

    Returns string

    Name of action or null.

determineWireSignal

  • determineWireSignal(node: HTMLElement): string | object
  • Determine the name of the signal that should be listened to from the backend.

    The signal name is determined from the data-signal, data-action, name or id attribute (in that order.) For all attributes apart from data-signal, the value is wrapped in an object like { data: value-of-attribute }. The data-signal value can contain a : which will be used to create an object as well. That means that data-signal="data:myvalue" gives the same result as data-action="myvalue".

    Parameters

    • node: HTMLElement

      A HTML element.

    Returns string | object

    Name of a signal or null.

render

Static defaultAlert

  • defaultAlert(message: string, count: number): string
  • The default formatter function

    Parameters

    • message: string

      A message.

    • count: number

      Count of the message.

    Returns string

    HTML formatted version of the inputs.

Static skipWire

  • skipWire(node: HTMLElement): boolean
  • Determine whether to skip this element.

    This can be forced by adding a data-skipwire=true attribute to the HTML tag.

    Parameters

    • node: HTMLElement

      A HTML element.

    Returns boolean

Static wire

  • wire(conn: Connection, id?: string, formatter?: function): void
  • Wire all status logs.

    Parameters

    • conn: Connection
    • Default value id: string = "databench-alerts"
    • Default value formatter: function = StatusLog.defaultAlert
        • (message: string, count: number): string
        • Parameters

          • message: string
          • count: number

          Returns string

    Returns void

Generated using TypeDoc