Client-side Webconsole base library
    Preparing search index...

    Class JGConsole

    A class with static members that makes the console and the types used by the API available together with some utilty functions. Usually imported as JGConsole. Of course, the types and functions may also be imported individually.

    The class is also registered as window.JGConsole for non-modular JavaScript.

    Index
    formatMemorySize: (
        size: number,
        digits: number,
        lang: string | number | undefined,
    ) => string = formatMemorySize

    Type Declaration

      • (size: number, digits: number, lang: string | number | undefined): string
      • Utility function to format a memory size to a maximum of 4 digits for the integer part by appending the appropriate unit.

        Parameters

        • size: number

          the size value to format

        • digits: number

          the number of digits of the factional part

        • lang: string | number | undefined

          the language (BCP 47 code, used to determine the delimiter)

        Returns string

    instance: Console = theConsole
    Log: typeof Log = Log
    NotificationType: typeof NotificationType = NotificationType
    OptionsSet: typeof OptionsSet = OptionsSet
    parseHtml: (html: string) => HTMLElement[] = parseHtml

    Type Declaration

      • (html: string): HTMLElement[]
      • Converts a string with HTML source to a single or multiple DOM trees.

        Parameters

        • html: string

        Returns HTMLElement[]

        the root nodes of the DOM trees

    Renderer: typeof Renderer = Renderer
    RenderMode: typeof RenderMode = RenderMode
    TableController: typeof TableController = TableController
    • Returns the data (data-* Attribute) of the specified element with the given key. If it does not exist, it set to the value provided by the supplier function.

      Parameters

      • node: HTMLElement

        the DOM element

      • key: string

        the key of the data

      • supplier: () => string

        the supplier function

      Returns string

    • Finds the lang specific item in a map of items by language. The function first tests for a property as specified by lang, then removes any trailing "-..." from lang and tries again. If not successful, it tests for an entry using "en" and if still no match is found it returns null.

      Parameters

      • items: Map<string, string> | Map<string, Map<string, string>>

        the messages by language identifier

      • lang: string

        the language identifier

      • fallback: string = 'en'

        fallback language (defaults to 'en')

      Returns string | Map<string, string> | null

    • Delegates to Console.init.

      Parameters

      • connectionId: string
      • options: any

      Returns void

    • Localizes the given key, using the provided localizations and language.

      First, the implementation looks up a mapping using forLang(l10ns, lang, fallback). Then it looks for an entry for key. If none is found, it returns the value of key.

      Parameters

      • l10ns: Map<string, Map<string, string>>

        the mappings by language identifier

      • lang: string

        the language identifier

      • key: string

        the key to look up

      • fallback: string = 'en'

        fallback language (defaults to 'en')

      Returns string

    • Parameters

      • conletId: string
      • method: string
      • ...params: any[]

      Returns void

    • Parameters

      • conletClass: string
      • functionName: string
      • conletFunction: (conletId: string, ...args: any[]) => void

      Returns void