Module Resources

Index

Functions

Functions

addEventListener(type: string, listener: Function, useCapture?: boolean)

Registers an event handler for the specified event. Use this method to register for events that are related to resources, such as when the app's language, scale, or contrast changes.

Parameters

  • type: string

    The name of the event to handle.

  • listener: Function

    The listener (event handler function) to associate with the event.

  • useCapture?: boolean optional

    Set to true to register the listener for the capturing phase; otherwise, set to false to register the listener for the bubbling phase.

dispatchEvent(type: string, details: any)

Raises an event of the specified type and with the specified additional properties.

Parameters

  • type: string

    The name of the event to raise.

  • details: any

    The set of additional properties to attach to the event object.

getString(resourceId: string): { value: string; empty?: boolean; lang?: string; }

Retrieves the resource string that has the specified resource identifier.

Parameters

  • resourceId: string

    The resource ID of the string to retrieve.

Returns

{ value: string; empty?: boolean; lang?: string; }

An object that can contain these properties: value, empty, lang.

oncontextchanged(eventInfo: CustomEvent)

Occurs when the user changes the system's language or contrast, or the scale of the display, or when the user changes any of the items in the current context's qualifier values list. For more info about the current context's qualifier values list, see the Remarks section.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.qualifier, detail.changed.

processAll(rootElement?: HTMLElement)

Processes data-win-res attributes on elements and replaces attributes and properties with resource strings.

Parameters

  • rootElement?: HTMLElement optional

    The element to process. The element and its child elements will be processed. If an element isn't specified, the entire document is processed.

removeEventListener(type: string, listener: Function, useCapture?: boolean)

Removes an event listener that the addEventListener method registered.

Parameters

  • type: string

    The name of the event that the event listener is registered for.

  • listener: Function

    The listener (event handler function) to remove.

  • useCapture?: boolean optional

    Set to true to remove the capturing phase listener; set to false to remove the bubbling phase listener.