Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Diagnostics

console featuring coloring, fontSize and enabled state.

Hierarchy

  • Diagnostics

Hierarchy-Diagram

Index

Constructors

constructor

  • new Diagnostics(enabled?: boolean, fontSize?: string): Diagnostics
  • Parameters

    • Default value enabled: boolean = false
    • Default value fontSize: string = "12px"

    Returns Diagnostics

Properties

debug

debug: LogFunc

Private enabled_

enabled_: boolean

error

error: LogFunc

Private fontSize_

fontSize_: string

info

info: LogFunc

log

log: LogFunc

trace

trace: LogFunc

warn

warn: LogFunc

warning

warning: LogFunc

Accessors

enabled

  • get enabled(): boolean
  • set enabled(enabled: boolean): void
  • Returns boolean

  • Parameters

    • enabled: boolean

    Returns void

fontSize

  • get fontSize(): string
  • set fontSize(fontSize: string): void
  • Returns string

  • Parameters

    • fontSize: string

    Returns void

Methods

assert

  • evaluates given check expression as a strong invariant never ever violated.

    Use assert to ensure an assumption at runtime. When running with assertions enabled, the check expression is evaluated immediately. A check expression evaluating to false signals a violation of invariant that should never happen. If it does, a hard error is output unconditionally to the console and an AssertionError is thrown.

    Do not use assertions as a means of ordinary error checking. Here are some valid examples of assertions:

        assert(() => Date.now() > 0, 'current time millis can not be before 1970 start of time!');
        assert(() => total_price >= item_price,
                     'total is sum of individual prices and thus can not be less than each one!');
        assert(() => num*num >= 0, 'squared num is less than zero!');
    

    Parameters

    • check: AssertionCheck | boolean

      expression validating an assumption of the calling code, typically an arrow-function expression.

    • Optional message: string

      optional explanation of disaster.

    Returns void

assertIsError

  • assertIsError(error: any, message?: string): boolean
  • used in catch-blocks or Promise rejection callbacks to ensure the caught value is an Error.

    Parameters

    • error: any

      to check.

    • Optional message: string

      of disaster.

    Returns boolean

    value evaluating to true stating error is an instance of Error.

Private reset

  • reset(): void
  • Returns void

Static Private STUB

  • STUB(): void
  • Returns void

Static Private toSource

  • toSource(func: Function): string
  • uses toSource() if available, falling back to toString() otherwise.

    Parameters

    • func: Function

      to generate source of.

    Returns string

    of func.

Generated using TypeDoc