Skip to content

Commit

Permalink
Merge pull request #89 from Vretta/master
Browse files Browse the repository at this point in the history
Added example to Register.MessageHook
  • Loading branch information
pkra committed Mar 12, 2015
2 parents d123fbb + 84d9a37 commit 5c6f20c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/hub.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@ Methods
`New Math` messages are sent). When the message equals the
`type`, the `callback` will be called with the message as its
parameter.

The following is an example for using the MessageHook to list
internal errors within MathJax which would otherwise be silent:

.. code-block:: javascript
MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
// do something with the error. message[1] will contain the data about the error.
});

MathJax.Hub.Register.MessageHook("Math Processing Error",function (message) {
// do something with the error. message[2] is the Error object that records the problem.
});

:Parameters:
- **type** --- a string indicating the message to look for
Expand Down

0 comments on commit 5c6f20c

Please sign in to comment.