Interface IMessageHook

An object which intercepts messages sent to a message handler.


A message hook is useful for intercepting or spying on messages sent to message handlers which were either not created by the consumer, or when subclassing the handler is not feasible.

If messageHook returns false, no other message hooks will be invoked and the message will not be delivered to the handler.

If all installed message hooks return true, the message will be delivered to the handler for processing.

See also: MessageLoop.installMessageHook and MessageLoop.removeMessageHook

interface IMessageHook {
    messageHook(handler, msg): boolean;



  • Intercept a message sent to a message handler.


    • handler: IMessageHandler

      The target handler of the message.

    • msg: Message

      The message to be sent to the handler.

    Returns boolean

    true if the message should continue to be processed as normal, or false if processing should cease immediately.