I think it would be best to only add new functionality if it is
difficult to achieve with the current framework. You can run
Javascript code from a JNEXT plugin quite easily using the existing
framework by deriving a class from JSExt and implementing the
NotifyEvent method (in the same way it is done in the filereader
sample), Then you can invoke NotifyEvent using the JavaScript function
call as the string parameter. This will end up calling the JavaScript
function JNEXT_callback_native2js in the jnext.js file.
So all you have to do to add the ability to call any JavaScript
function is to modify the code to detect a function call in
JNEXT_callback_native2js (you can do this by using some unique
identifier that indicates that this callback is to be used to invoke
JavaScript code) and then use "eval" on the function that is passed to
it.
I hope my understanding of the feature you proposed is correct. Please
let me know if this implementation method suits your purpose.
-Amnon
void JSExt::CallJSFunc( const char* szFunc )
{
string strFunc = szEvent;
string strFileEvent = m_strObjId + " func " + strEvent;
SendPluginEvent( strFileEvent.c_str(), m_pContext );
}
and then modify the code in JNEXT_callback_native2js (in jnext.js) to
detect the "func" identifier and if it exists "eval" the next parameter.
In any case, I'll be happy if you would send me the code if you think
there are other issues that I haven't addressed here or that can be
implemented in an easier way.
All the best,
Amnon