2008-07-10 13:31:22 -04:00
|
|
|
Most of the SpiderMonkey scripting interface is documented in the
|
|
|
|
ELinks manual. This README describes only features added by
|
|
|
|
contrib/smjs/*.js.
|
2006-11-14 11:13:11 -05:00
|
|
|
|
|
|
|
|
2008-07-10 13:31:22 -04:00
|
|
|
Multiple functions in the same hook
|
|
|
|
-----------------------------------
|
2006-11-14 11:13:11 -05:00
|
|
|
|
2008-07-10 13:31:22 -04:00
|
|
|
The default hooks file contrib/smjs/hooks.js assigns functions that
|
|
|
|
provide a mechanism to register multiple functions to each hook. When
|
|
|
|
these default hooks are called, they iterate over all functions that
|
|
|
|
are registered to them, calling each one in serial.
|
2006-11-14 11:13:11 -05:00
|
|
|
|
|
|
|
If you want to register a preformat_html hook, for example,
|
|
|
|
the preferred way to do so is not this:
|
|
|
|
|
|
|
|
elinks.preformat_html = foo;
|
|
|
|
|
|
|
|
but rather this:
|
|
|
|
|
|
|
|
elinks.preformat_html_hooks.push(foo);
|
|
|
|
|
|
|
|
which adds foo to an array of functions, over which the default
|
|
|
|
elinks.preformat_html function will iterate.
|
|
|
|
|
|
|
|
If any function in that array returns false, the default hook
|
|
|
|
will stop iteration, not calling any more handlers. This applies
|
2008-07-10 13:31:22 -04:00
|
|
|
to all of the default hooks:
|
2006-11-14 11:13:11 -05:00
|
|
|
|
2008-07-10 13:31:22 -04:00
|
|
|
- elinks.preformat_html_hooks
|
|
|
|
- elinks.goto_url_hooks
|
|
|
|
- elinks.follow_url_hooks
|