Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

victorbernard

macrumors newbie
Original poster
Apr 1, 2010
2
0
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:parameterList];

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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.