@mathjax/src
    Preparing search index...

    Class WorkerHandler<N, T, D>

    The main WorkerHandler class

    Type Parameters

    • N

      The HTMLElement node class

    • T

      The Text node class

    • D

      The Document class

    Index

    Constructors

    Properties

    adaptor: DOMAdaptor<N, T, D>

    The adaptor to use for DOM access.

    Commands: {
        [id: string]: (handler: WorkerHandler<N, T, D>, data: Message) => void;
    } = ...

    The list of valid commands from the Worker.

    ready: boolean = false

    Callback for ready signal

    worker: minWorker

    The webworker

    Methods

    • Attach the speech structure to an item's DOM

      Parameters

      • item: SpeechMathItem<N, T, D>

        The SpeechMathItem to attach to

      • speech: boolean

        True when speech should be added

      • braille: boolean

        True when Braille should be added

      • structure: string

        The speech JSON structure to attach

      Returns void

    • Worker call to compute clearspeak preferences for the current locale.

      Parameters

      • options: OptionList

        The options list.

      • prefs: Map<string, { [prop: string]: string[] }>

        Map to store the compute preferences.

      Returns Promise<void>

      The promise that resolves when the command is complete

    • Computes the clearspeak preference category that are semantically relevant for the currently focused node.

      Parameters

      • math: string

        The linearized mml expression.

      • nodeId: string

        The semantic id of node to compute the preference for.

      • prefs: Map<number, string>

        Map for recording the computed preference.

      • counter: number

        Counter for storing the result in the map.

      Returns Promise<void>

      The promise that resolves when the command is complete

    • Recursively remove speech attributes from a DOM tree

      Parameters

      • node: N

        The root node of the tree to modify

      Returns void

    • Listener for the messages from the worker. The message will contain a command and data, and we look in the list of commands to see if we have an implementation for the given one. If so, we run the command on the data from the message, otherwise we throw an error.

      Parameters

      • event: MessageEvent

        The message event.

      Returns void

    • Computes the next rule set for this particular SRE setting. We assume that the engine has been set to the options of the current expression.

      Parameters

      • math: string

        The mml string.

      • options: OptionList

        The options list.

      • item: SpeechMathItem<N, T, D>

        The mathitem for reattaching the speech.

      Returns Promise<void>

      A promise that resolves when the command completes

    • Computes the next style for the particular SRE settings and the currently focused node. We pass the options of the current expression.

      Note, that we compute not only the next style but also the next speech structure in the method, as smart computation is done wrt. the semantic node, and we do not want to reconstruct the semantic XML tree on the SRE side twice. Hence we pass the math expression, plus the semantic ID of the currently focused node.

      Parameters

      • math: string

        The linearized mml expression.

      • options: OptionList

        The options list.

      • nodeId: string

        The semantic Id of the currenctly focused node.

      • item: SpeechMathItem<N, T, D>

        The mathitem for reattaching the speech.

      Returns Promise<void>

      A promise that resolves when the command completes

    Post

    • Post(msg: ClientCommand, item?: SpeechMathItem<N, T, D>): Promise<any>

      Send messages to the worker.

      Parameters

      • msg: ClientCommand

        The command message.

      • Optionalitem: SpeechMathItem<N, T, D>

        Optional SpeechMathItem that is being processed command name as input.

      Returns Promise<any>

      A promise that resolves when the command completes

    • Adds a set of attributes to the given node.

      Parameters

      • node: N

        The node on which to set attributes.

      • map: OptionList

        The attribute to value map.

      • prefix: string

        A possible prefix for the attribute name.

      • Optionalkeys: string[]

        An optional list to select only those attributes.

      Returns void

    • Add the speech attributes to a node

      Parameters

      • node: N

        The node to add speech to

      • data: Structure

        The speech data to use

      • speech: boolean

        True when speech should be added

      • braille: boolean

        True when Braille should be added

      Returns void

    • Add the speech attributes to a node's DOM tree

      Parameters

      • root: N | T

        The node to add speech to

      • rootId: string

        The root nodes's ID

      • data: Structure

        The speech data to use

      • speech: boolean

        True when speech should be added

      • braille: boolean

        True when Braille should be added

      Returns string

      The updated root ID