wei-spring / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

exposeInJavascript iOS implementation #455

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently exposeInJavascript is not implemented on iOS.  I believe I can 
implement it without too much difficulty if we add a marker interface 
"JavascriptInterface" to the CodenameOne API to mark classes that should be 
"web scriptable".

The implementation would require some code generation stubs (similar to the 
ones generated for Native Interfaces) but this won't be difficult to create 
using an AnnotationProcessor.

I would be following the strategy that Cordova uses for this sort of thing.  
E.g.
https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/C
DVViewController.m

Since this would require the generation of stubs, it would make the most sense 
to add the generation of these stubs on the build server.

Do you have any comments, concerns, or objections about this proposed 
implementation?

-Steve

Original issue reported on code.google.com by st...@weblite.ca on 27 Dec 2012 at 8:34

GoogleCodeExporter commented 9 years ago
I generally agree with following the Cordova lead there. However, I wouldn't 
want to do the server sort of processing here see my answer to 453. I would 
rather have the simplest possible solution that "works" and build from that 
point.

Original comment by shai.almog on 27 Dec 2012 at 6:49