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

Web and WebWorks Development

Reply
Developer
levidehaan
Posts: 49
Registered: ‎02-09-2011
My Device: Not Specified
Accepted Solution

Has anyone used LABjs or Requirejs successfully?

Hi I want to use requirejs or LABjs to load js files,

It takes so frickin long to test on the bb enviroment that debugging is insane, any small change takes forever, so instead i figured why not ask here :smileyhappy:.

Here's what I have if your up for testing yourself.

 

Got grab requirejs

 

toss it in your directory:

 

<script type="text/javascript" src="js/require.js"></script>
        <script>
            if(require){ alert ("require loaded"); }else{ alert("require not loaded")};
           try{ 
            require({
                baseUrl: "local:///",
                paths: {
                    "bbfiles": "local:///bbfiles/",
                    "js": "local:///js/",
                    "db": "local:///js/database/"
                },
                waitSeconds: 5
            },
            ["js/jquery-1.5.min.js", "js/jquery.mobile-1.0a3.min.js", "bbfiles/control.js", "js/main.js"],
            function() {
                if(jQuery){ alert ("jquery loaded"); }else{ alert("jquery not loaded")};
                initPage();
            }
        );
            }
            catch (e)
            {
                alert ("error: " + e);
            }
         
        </script>

 thats one way i tried, i also removed the base and paths from the config

 

 

<script type="text/javascript" src="js/require.js"></script>
        <script>
            if(require){ alert ("require loaded"); }else{ alert("require not loaded")};
           try{ 
            require(
            ["js/jquery-1.5.min.js", "js/jquery.mobile-1.0a3.min.js", "bbfiles/control.js", "js/main.js"],
            function() {
                if(jQuery){ alert ("jquery loaded"); }else{ alert("jquery not loaded")};
                initPage();
            }
        );
            }
            catch (e)
            {
                alert ("error: " + e);
            }
         
        </script>

 

 

I get the alert that require is loaded, but thats it, no error or anything, has anyone tried firebug lite on here?

 

 

<script type="text/javascript"></script> <script type="text/javascript"></script>

Please use plain text.
Developer
levidehaan
Posts: 49
Registered: ‎02-09-2011
My Device: Not Specified

Re: Has anyone used LABjs or Requirejs successfully?

oh nvm I figured it out

best way is using paths with local:/// so the top one

 

I went through and removed my app, and installed it again and for some reason this worked.

so apparently best practice is to install app, test, remove app rinse repeat

Please use plain text.
New Member
bert2000
Posts: 3
Registered: ‎03-10-2013
My Device: Simulator

Re: Has anyone used LABjs or Requirejs successfully?

LABjs don't work, if I load my App in the BB10 Alpha Simulator. I found not errors. I can load my webApp from a Webserver in the browser, there are not problems. Does anyone have experience with labjs, I have no idea what I can do.

 

I've tried option, but without success:

 

$LAB
.setOptions({BasePath:"local:///"})

 

About help I would be very happy, greetings

Bert

Please use plain text.