Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Log

Shows all console.log() messages and log actions from backend.

Usually wired to a <pre id="log"> element.

Hierarchy

Index

Constructors

constructor

  • new Log(node: HTMLElement, limitNumber?: number, limitLength?: number): Log
  • Parameters

    • node: HTMLElement

      Primary node.

    • Default value limitNumber: number = 20

      Maximum number of messages to show.

    • Default value limitLength: number = 250

      Maximum length of a message.

    Returns Log

Properties

_messages

_messages: string[][]

actionName

actionName: string

idCount

idCount: number

limitLength

limitLength: number

limitNumber

limitNumber: 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

  • add(message: any, source?: string): Log
  • Parameters

    • message: any
    • Default value source: string = "unknown"

    Returns Log

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

  • render(): Log

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, wireSignals?: string[], limitNumber?: number, limitLength?: number): void
  • Wire all logs.

    Parameters

    • conn: Connection
    • Default value id: string = "log"
    • Default value wireSignals: string[] = ['log', 'warn', 'error']
    • Default value limitNumber: number = 20
    • Default value limitLength: number = 250

    Returns void

Generated using TypeDoc