Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • JGConsole

Index

Constructors

Properties

Log: typeof default = Log
NotificationType: typeof NotificationType = NotificationType
OptionsSet: typeof OptionsSet = OptionsSet
RenderMode: typeof RenderMode = RenderMode
Renderer: typeof Renderer = Renderer
TableController: typeof TableController = TableController
formatMemorySize: (size: number, digits: string | number, lang: undefined | string | number) => string = formatMemorySize

Type declaration

    • (size: number, digits: string | number, lang: undefined | string | number): 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: string | number

        the number of digits of the factional part

      • lang: undefined | string | number

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

      Returns string

instance: Console = theConsole
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

Methods

  • createIfMissing(node: HTMLElement, key: string, supplier: () => string): string
  • 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

        • (): string
        • Returns string

    Returns string

  • findConletPreview(conletId: string): null | HTMLElement
  • findConletView(conletId: string): null | HTMLElement
  • forLang(items: Map<string, string> | Map<string, Map<string, string>>, lang: string, fallback?: string): null | string | Map<string, 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 null | string | Map<string, string>

  • init(consoleSessionId: string, options: any): void
  • localize(l10ns: Map<string, Map<string, string>>, lang: string, key: string, fallback?: string): string
  • 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

  • lockMessageQueue(): void
  • notifyConletModel(conletId: string, method: string, ...params: any[]): void
  • registerConletFunction(conletClass: string, functionName: string, conletFunction: (conletId: string, ...args: any[]) => void): void
  • Parameters

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

          • conletId: string
          • Rest ...args: any[]

          Returns void

    Returns void

  • unlockMessageQueue(): void
  • uuid(): string

Generated using TypeDoc