jquery - How to find JavaScript code that is waiting on promise -
We have a complex complex asynchronous system in JavaScript. All functions in the JavaScript library are designed to be asynchronous. We mainly use AngularJS deferred items and use jQuery in some parts (we do not have to collect them - i.e. Angular code Kangra waits on deferred promise.)
The problem It is that we are coming to all this code "hang" on the start-up, 2 times from 5 times It seems that when there is a problem, the JS code is cached and the time for the resolution of the promise is.
It does not seem to be such a device, what can be anything which can indicate what the offending code is waiting for
thanks.
Therefore the error has actually expired, not related to the promise, but the timing of loading dependencies. We are using LAB.js as a file loader. LAB.js supports the "chain" loading mechanism of javascript dependencies.
What was happening was that we did not tell the two chains related to each other, both of which were loaded asynchronously and thus, at the point of running a javascript file, such an object Had the opportunity to try to use which was not loaded.
How to add this problem was Angular.js 1.2. 13 In this scenario silently failed. An exception was generated during the loading of the cooner services and the exception was never promoted to high level code nor any debug was that it affected an exception:
function GetService (serviceName) {if (cache .hasOwnProperty (serviceName)} {if (cache [serviceName] === INSTAINIATING) {$ INJECTERMinErr ('CDAP', 'Circular dependency found: {0}', path.join (' & Lt; - ')); } Return Cache [serviceName]; } Else {try {path.unshift (serviceName); Cache [serviceName] = institing; Return cash [serviceName] = factory (savanam); } Hold (error) {if (cache [serviceName] === INSTAINIATING) {delete cache [serviceName]; } throw; } Finally {path.shift (); }}} The above throwing was not found through the browser and was caught elsewhere in the system and "ignored". Once we got an exception, it was easy to track chain loading problem.
Comments
Post a Comment