Labjs - error loading scripts

Asked

Viewed 217 times

0

Please don’t show me the documentation link http://labjs.com/documentation.php or examples taken from there because this I have read, and honestly did not understand why my error code "from time to time" that is, the page loads about three times and then one of the error.

So I’m believing that the problem is the asymchronism, I’ve already moved a lot in the order of scripts, putting . Wait in everything, only in a few and finally came to nothing follows the last test:

$LAB            
.script('../js/date.js')                                        // NAO TEM DEPENDENCIA
.script('../js/plugin/jquery.insc.estadual.js')                 // NAO TEM DEPENDENCIA            
.script('../js/node/socket.io.js').wait()                       // NAO TEM DEPENDENCIA
.script('../js/js_1.9/jquery-1.8.2.js').wait()                  // NAO TEM DEPENDENCIA
.script('../js/jquery.shortcuts.min.js')                        // DEPENDE DE JQUERY
.script('../js/jquery.meiomask.js')                             // DEPENDE DE JQUERY
.script('../lib/jquery.validate.js')                            // DEPENDE DE JQUERY
.script('../js/js_1.9/jquery-ui-1.9.1.custom.min.js').wait()    // DEPENDE DE JQUERY                        
.script('../js/dataBr.js')                                      // DEPENDE DE JQUERY E JQUERY-UI
.script('../js/plugin/jquery.zoomooz.js')                       // DEPENDE DE JQUERY E JQUERY-UI                        
.script('../js/custom_jquery.js?nocache='+Math.random())        // DEPENDE DE JQUERY E JQUERY-UI                            
.script('../js/principal.js?nocache='+Math.random());           // DEPENDE DE JQUERY , JQUERY-UI E SOCKET.IO

Errors that appear sporadically are: inserir a descrição da imagem aqui

sometimes just these: inserir a descrição da imagem aqui

sometimes only one: inserir a descrição da imagem aqui

I’m more lost than early in shooting, someone can give me help ?

  • I’m not an expert in php and much less in labjs, but from what I understand of his workings, you don’t need a wait() to the socket.io and the jquery.insc.estadual depends on jquery, so it should come after it, finally I believe it is necessary a wait() before the principal.js, as in this codebin

  • @Tobymosque thought that jquery.insc.estadual has dependency because of the file name, but I’ve opened the file and it’s pure javascript, I put the name in it wrong, the socket.io I put it in the wait because the main.js depends on it

  • from what I understand from labjs, it will asynchronously download the files, the wait() will cause it to wait for all scripts to download and run before continuing, then putting the wait() after the jquery.js, will make him wait for the completion of date.js, insc.estadual.js, socket.io.js and the jquery.js, then there is no need for a wait() to the socket.io. really the name of insc.estadual.js made me think he depended on jquery.js.

  • But I still believe principal.js make some use of dataBr.js, zoomooz.js or custom_jquery.js, so I asked to put a wait() after the custom_jquery.js

  • tried but did not resolve

  • the problem must be script conflict, some script is conflicting with others, and when it loads faster than the other, it gives this error. Try to change their order and run tests. I believe jquery should always stay at the top. I wouldn’t trust this one .wait()

  • @Ivanferrer the whole idea is based on the confidence of this . Wait() rsrsrsrsr, the jquery on top as first was my first attempt, I ended up putting others on top of it to separate what has no dependency, but thank you anyway

Show 2 more comments

1 answer

0


Well I’m going to put the solution here so that others don’t have to waste time when that happens, well strange things happen in this life, and that was one of the strange cases, maybe someone knows why of these things, I’ll just deviate them by not understanding very well.

First this test was done with the firebug in the firefox, taste a lot and always used and I will probably always use it, leaving the achismo aside let’s go ahead, with the code the same way it hit me in the head to test with the Chrome with the as developer tools standard, to my surprise all the repeated times I tested were successful.

Right back to the firefox got the developer tool pattern and tested again and it all worked out too, but before posting my response and putting all the blame on firebug I did other tests, and to my surprise the problem could be presented in both browsers with any tool that was connected all monitoring options.

In other words, when enabled console, script, network and cookie with all available options generated this error, even with these monitors turned on the time to open the page was much bigger, without these monitors turned on is around 400ms, with the monitors turned on it was enough to give 3 seconds to load and many of the times these errors occurred, now why this may even be pertinent in another question

Browser other questions tagged

You are not signed in. Login or sign up in order to post.