Interface nsITextInputProcessorCallbackType

nsITextInputProcessorCallback is a callback interface for JS to implement IME. IME implemented by JS can implement onNotify() function and must send it to nsITextInputProcessor at initializing. Then, onNotify() will be called with nsITextInputProcessorNotification instance. The reason why onNotify() uses string simply is that if we will support other notifications such as text changes and selection changes, we need to notify IME of some other information. Then, only changing nsITextInputProcessorNotification interface is better for compatibility.

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • When Gecko notifies IME of something or requests something to IME, this is called.

    Returns

    Return true if it succeeded or does nothing. Otherwise, return false.

    Example #1 The simplest implementation of nsITextInputProcessorCallback is:

    function simpleCallback(aTIP, aNotification) { try { switch (aNotification.type) { case "request-to-commit": aTIP.commitComposition(); break; case "request-to-cancel": aTIP.cancelComposition(); break; } } catch (e) { return false; } return true; }

    var TIP = Components.classes["@mozilla.org/text-input-processor;1"]. createInstance(Components.interfaces.nsITextInputProcessor); if (!TIP.init(window, simpleCallback)) { return; }

    Parameters

    • aTextInputProcessor: nsITextInputProcessor

      Reference to the nsITextInputProcessor service which is the original receiver of the request or notification.

    • aNotification: nsITextInputProcessorNotification

      Stores type of notifications and additional information.

    Returns boolean

Generated using TypeDoc