using class.js functions from webkit

11 views
Skip to first unread message

Corey

unread,
Aug 26, 2011, 1:31:56 PM8/26/11
to JSCocoa
I'm using JSCocoa in place of the existing WebKit bridge, and it is
mostly working great! The problem is with functions like `outArgument`
or anything defined in class.js. None of them are accessible via
webkit.

I've tried:
var x = new outArgument

and:
var x = new OSX.outArgument

But neither work, and none of the other methods in class.js work. I've
verified that class.js is being loaded here
https://github.com/parmanoir/jscocoa/blob/master/JSCocoa/JSCocoaController.m#L274
But I still don't have access to any of the functions.

Thanks,
Corey

Corey Johnson

unread,
Aug 26, 2011, 2:54:45 PM8/26/11
to jsc...@googlegroups.com
It looks like the class.js code is NOT being called from the WekKit bridge because it sends in a context (ctx). Is there any reason for that?

Patrick Geiller

unread,
Aug 26, 2011, 3:17:34 PM8/26/11
to jsc...@googlegroups.com

> It looks like the class.js code is NOT being called from the WekKit bridge because it sends in a context (ctx). Is there any reason for that?

Yes, class.js mainly handles the custom class syntax which might interfere with WebKit syntax, so it's disabled by default.
The outArgument code wouldn't work as-is in a WebView because all ObjC class accesses needs to be prefixed with 'OSX'.

Right now you can try copying the 'outArgument' code and prefixing the class access with 'OSX' (eg OSX.JSCocoaOutArgument2.instance, etc.)

-Patrick

Reply all
Reply to author
Forward
0 new messages