I am writing a plugin and wish to send events to my javascript code.
To do this I used the following code
id objectContainer = [_arguments objectForKey:WebPlugInContainerKey];
id pluginContainer = [_arguments objectForKey:WebPlugInContainingElementKey];
NSString* callbackName = @"dispatchTheEvent"; // @"dispatchEvent";
NSArray* parameterList = [NSArray arrayWithObjects:_pluginContainer, event, nil];
[[myWebView windowScriptObject] callWebScriptMethod:callbackName withArguments
arameterList];
In my javascript code I wrote a function dispatchTheEvent
function dispatchTheEvent( plugin, event )
{
plugin.dispatchEvent( event );
}
This code works fine, However I cannot directly call dispatchEvent on the plugin or the document. I am only able to call methods that are written in my javascript code and not other methods which may be native.
How can I directly call plugin.dispatchEvent from objective C?
To do this I used the following code
id objectContainer = [_arguments objectForKey:WebPlugInContainerKey];
id pluginContainer = [_arguments objectForKey:WebPlugInContainingElementKey];
NSString* callbackName = @"dispatchTheEvent"; // @"dispatchEvent";
NSArray* parameterList = [NSArray arrayWithObjects:_pluginContainer, event, nil];
[[myWebView windowScriptObject] callWebScriptMethod:callbackName withArguments
In my javascript code I wrote a function dispatchTheEvent
function dispatchTheEvent( plugin, event )
{
plugin.dispatchEvent( event );
}
This code works fine, However I cannot directly call dispatchEvent on the plugin or the document. I am only able to call methods that are written in my javascript code and not other methods which may be native.
How can I directly call plugin.dispatchEvent from objective C?