Register function in javascript engine RootObject

Is there anyway of registering a function in the javascript engine RootObject? or I have to modify the javascript engine?.

Take a look at the DynamicObject class - if you subclass this you can then override hasMethod() and invokeMethod() to give your object methods. You can then add this object to the root namespace by calling the JavascriptEngine::registerNativeObject() method and its methods can be called with the JavascriptEngine::callFunction() method.


1 Like