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
anditsung
Posts: 246
Registered: ‎09-30-2010
My Device: Z10, Onyx2
Accepted Solution

import javascript

hello im trying to import javascript into my qml file...

 

using 

import "assets:///javascript/sha1.js" as sha1java

 

but if i import the file the screen that i use for it will not be able to push

 

the javascript that i use was

https://raw.github.com/kvz/phpjs/master/functions/strings/sha1.js

 

anyone know the problem?

im using SDK 10.1.0.338

Please use plain text.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: import javascript

Do you get any errors in the console log?


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
anditsung
Posts: 246
Registered: ‎09-30-2010
My Device: Z10, Onyx2

Re: import javascript

im new to developing bb10..

how to do that?

when i try it on the device it will only show black screen

Please use plain text.
Developer
kunal_one
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha

Re: import javascript

It before adding the script, application is working fine. Then might be some error with your java script or how you use it.

 

Se this link, for getting output

http://supportforums.blackberry.com/t5/Cascades-Development/Where-the-display-of-out-put-of-console-...

 

or You might try to run java script with some html in browser, it should show java script related error

Please use plain text.
Developer
anditsung
Posts: 246
Registered: ‎09-30-2010
My Device: Z10, Onyx2

Re: import javascript

the error was

 

Script assets:///javascript/utils.js unavailable
import "assets:///javascript/utils.js" as Utils
^, assets:///javascript/utils.js: Network error)

 

but that was the location of the javascript.

how can it not available?

Please use plain text.
Developer
Ebscer
Posts: 875
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: import javascript

Try doing without the asset selector, and just try

 

import "javascript/utils.js" as Utils

 

If that still doesn't work, In my code I don't have the javascript in a subfolder so it is just

 

import "utils.js" as Utils

 and I can confirm that this does work...


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.
Developer
anditsung
Posts: 246
Registered: ‎09-30-2010
My Device: Z10, Onyx2

Re: import javascript

found the solution....

for javascript using from other folder must be using ".."

cannot state as full folder even like "assets:///javascript/utils.js"

so using ".." will move to the upper folder same as change drive function

import "utils.js" as Utils

thi can only be used on the javascript that same as the folder as the code that execute it
Please use plain text.