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

Native Development

Reply
Developer
sanj1504
Posts: 108
Registered: ‎06-25-2013
My Device: Z10

Pass a file as a parameter to javascript layer

I have a requirement to pass a file as a parameter to the javascript layer.

 

i am able to pass any variable to JS layer.

 

But have to pass a file either an image or a text file to JS layer.

 

How to pass it ?

 

Regards

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Pass a file as a parameter to javascript layer

By JS layer you mean QML? I assume you've seen this page:

http://developer.blackberry.com/native/documentation/cascades/dev/integrating_cpp_qml/

 

The question is not very detailed to give an exact advice, but depending on what you're going to do with that file on JS layer, you can pass a filename, a QByteArray holding the data, or a pointer to a class instance such as Image. If the file resides on disk and will be loaded on QML side, then filename seems to be the most straightforward way.


Andrey Fidrya, @zmeyc on twitter
Please use plain text.