I'm debugging a solution, where all content suddenly "collapses". I've discovered that Dw loads a script in called RequestQueue.js — as this is dependent on the Prototype library, this is also loaded in. Problem is, this screws up my jQuery scripts. It seems to be a recent change, as we have not been developing on the solution for quite a while, and it has been working fine up untill recently.
I have been able to stop it from conflicting for now, but it's still loaded.
What on Earth does Dw use RequestQueue.js for? How may I disable it? All scripts and libraries are turned off in the management center, and it's definitely not in any templates.
Developer forum
E-mail notifications
What does Dw use RequestQueue.js for?
Nikki Strømsnes
Posted on 21/06/2012 14:02:07
Replies
Pavel Volgarev
Posted on 22/06/2012 09:22:37
HI Nikki,
Do you have a URL of the website where we can see the problem?
-- Pavel
Do you have a URL of the website where we can see the problem?
-- Pavel
Nikki Strømsnes
Posted on 22/06/2012 09:59:55
It seems to have disappeared, after I reported it to support, so I guess all is well. It would still be interesting to learn what the script is used for though, if only to satisfy my curiousity.
Pavel Volgarev
Posted on 22/06/2012 13:37:14
Hi Nikki,
The RequestQueue.js allows executing asynchronous methods sequentially.
The original implementation is defined in /Admin/Content/JsLib/dw/RequestQueue.js although this implementation is obsolete and the improved version of this functionality is now defined in /Admin/Content/JsLib/dw/Utilities.js (namespace-qualified name is Dynamicweb.Utilities.RequestQueue).
Below is an example of using RequestQueue. In this example I'm retrieving the weather forecast for three different places using AJAX. The requests to Yahoo Weather services are queued and executed sequentially in the order they're added.
I've attached the full example to this post (forecast.html).
-- Pavel
The RequestQueue.js allows executing asynchronous methods sequentially.
The original implementation is defined in /Admin/Content/JsLib/dw/RequestQueue.js although this implementation is obsolete and the improved version of this functionality is now defined in /Admin/Content/JsLib/dw/Utilities.js (namespace-qualified name is Dynamicweb.Utilities.RequestQueue).
Below is an example of using RequestQueue. In this example I'm retrieving the weather forecast for three different places using AJAX. The requests to Yahoo Weather services are queued and executed sequentially in the order they're added.
var beginGetForecast = function () { var progress = document.getElementById('progress'); progress.style.display = ''; getForecastSequential([ { name: 'Aarhus, Denmark', woeid: '552015' }, { name: 'New York, USA', woeid: '2459115' }, { name: 'Moscow, Russia', woeid: '2122265' } ], function() { progress.style.display = 'none'; } ); } var getForecastSequential = function(places, onComplete) { var output = document.getElementById('forecast'); // Instantiating the queue object var queue = new Dynamicweb.Utilities.RequestQueue(); output.innerHTML = ''; for (var i = 0; i < places.length; i++) { (function(p) { // Adding new task to the queue. // First argument: context in which the function is called. // Second argument: function to be called. // Third argument: An array of parameters to be passed to the function. queue.add(window, getForecast, [ p, function (result) { output.innerHTML += '<div>' + result.name + ', ' + result.date + ': ' + result.text + '</div>'; // "Next" will start executing the next function. // Returns: Value indicating whether there still was something to be executed. if (!queue.next()) { onComplete(); } } ]); })(places[i]); } // Beginning the execution of queued tasks queue.executeAll(); } var getForecast = function (place, onComplete) { var query = encodeURIComponent('select item.forecast from weather.forecast where woeid = "' + place.woeid + '"'); var url = 'http://query.yahooapis.com/v1/public/yql?q=' + query + '&format=json&callback=?'; $.getJSON(url, function (data) { var result = data.query.results.channel[0].item.forecast; onComplete({ name: place.name, date: result.date, text: result.text }); }); }
-- Pavel
Nikki Strømsnes
Posted on 25/06/2012 10:39:17
Thanks Pavel. That brings some light to the matter.
Do you have any idea why DW loads it into the frontend? Another developer reports that it is also suddenly loaded into a different solution, with the same devastating effect.
When it loads the Prototype library, our jQuery scripts breaks unless we have used noconflict.
Do you have any idea why DW loads it into the frontend? Another developer reports that it is also suddenly loaded into a different solution, with the same devastating effect.
When it loads the Prototype library, our jQuery scripts breaks unless we have used noconflict.
Pavel Volgarev
Posted on 28/06/2012 10:56:32
Hi Nikki,
Do you have a URL where I can see the problem?
-- Pavel
Do you have a URL where I can see the problem?
-- Pavel
You must be logged in to post in the forum