| 1 | Helma NG provides a mechanism to bind Javascript functions as callbacks for certain events. Events can be freely assigned, and it is possible to register multiple callbacks per event. |
| 3 | === Java API |
| 4 | |
| 5 | Class *org.helma.javascript.RhinoEngine|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html* provides methods *addCallback()|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html#addCallback(java.lang.String,%20java.lang.String,%20org.mozilla.javascript.Function)*, *removeCallback|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html#removeCallback(java.lang.String,%20java.lang.String)*, and *invokeCallback()|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html#invokeCallback(java.lang.String,%20java.lang.Object,%20java.lang.Object...)* to register, remove, and invoke callbacks. |
| 6 | |
| 7 | === Javascript API |
| 8 | |
| 9 | The *helma.rhino module|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/rhino.js* provides *addCallback(), removeCallback(), and invokeCallback() methods|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/rhino.js#L34* to register, remove and invoke callbacks. |
| 10 | |
| 11 | === Callbacks used by Helma core classes and modules |
| 12 | |
| 13 | * onInvoke is called by *org.helma.javascript.RhinoEngine|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html* immediately before request evaluation is started with the same arguments as the invocation. |
| 14 | * onRequest is called by the *helma.simpleweb|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/simpleweb.js* module at the beginning of the handleRequest() method with the Request object as argument. |
| 15 | * onResponse is called by the *helma.simpleweb|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/simpleweb.js* module at the end of the handleRequest() method with the Response object as argument. |
| 16 | * onLogEvent is called by *org.helma.util.RhinoAppender|http://dev.helma.org/static/ng/api/org/helma/util/RhinoAppender.html* with the formatted log message as argument and optionally a formatted stack trace as second argument. |