Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
lilbyrdie
Posts: 11
Registered: ‎08-21-2009
My Device: Not Specified

ScriptableFunction usage on 5.0

Hello,

 

I have a question about the usage of ScriptableFunction (the handler for extending Javascript in the new browser.field2) on 5.0:

 

I have a basic interface working and can get at parameters called by the Javascript when they are basic types.

 

However, when they are other types, such as Array(), this is more difficult. In fact, the Object is no longer usable because it's type isn't available in the SDK (it's ESObjectWrapper). It seems that it has all the data there, but wrapped up in some other form that isn't accessible. Through some debugging, I can see that the data is all there.

 

Is there some class to access the data? Or do I have to encode this myself through another type, such as a string? That seems less efficient, since something is actually coming through from the Javascript side.

 

Thanks for any help. I realize 5.0 is still beta, and so some items might change.

 

 

 

 

 

Please use plain text.
New Developer
lilbyrdie
Posts: 11
Registered: ‎08-21-2009
My Device: Not Specified

Re: ScriptableFunction usage on 5.0

Along these lines, anyone have any luck using the construct() method of ScriptableFunction?  

 

I haven't had any luck with that and I'm not sure how I'm supposed to return allocated objects. Does it convert Java objects? Or am I returning some other type?

 

Thanks! 

Please use plain text.
New Developer
lilbyrdie
Posts: 11
Registered: ‎08-21-2009
My Device: Not Specified

Re: ScriptableFunction usage on 5.0

Alright, I can use the construct() method of ScriptableFunction to return a basic Java Object, such as String or Integer. 

 

But I'm not really sure what use that is given how constructor methods are usually used with Javascript. I must be missing something. 

 

(I also seem to be just talking to myself here. If anyone else has information on this, please feel free to post. Thanks!) 

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: ScriptableFunction usage on 5.0

I'm reading - just got nothing useful to add.

Please use plain text.
New Developer
lilbyrdie
Posts: 11
Registered: ‎08-21-2009
My Device: Not Specified

Re: ScriptableFunction usage on 5.0

Thanks, Peter. Looks like that's the boat everyone is in on this topic. :smileyhappy:
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: ScriptableFunction usage on 5.0

I was going to suggest you try the Browser forum, but don't know enough to be sure that is a good idea.

 

Oldies like me are struggling with the concept of being able to run the Browser in a Java app anyway, without worrying about the finer details of it. That is why I'm reading, I'm hoping to learn!

Please use plain text.
New Contributor
gazsp
Posts: 7
Registered: ‎09-30-2010
My Device: Not Specified

Re: ScriptableFunction usage on 5.0

*bump*

 

I know this is a very old thread, but I'd be interested in how to access the data inside of an ESObjectWrapper object as well.

 

Why is this not documented anywhere?!

 

Cheers,

Gaz.

Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: ScriptableFunction usage on 5.0

ESObjectWrapper is an instanceof Scriptable. Hope that helps.

Please use plain text.
New Developer
ildoonet
Posts: 15
Registered: ‎10-04-2011
My Device: bold 9700
My Carrier: sktelecom

Re: ScriptableFunction usage on 5.0

This is very useful.

I can use 'getField' for getting json information.

Thanks.
Please use plain text.