[OpenLayers-Dev] @require issue with XHR code

Eric Lemoine eric.c2c at gmail.com
Tue Jun 10 10:11:36 EDT 2008


There's a dependency issue with the new XHR code.

If you have A.js that uses say Request.GET, in A.js you will use:

 * @requires OpenLayers/Request.js

The thing is that Request.js doesn't include "@require
OpenLayers/Request/XMLHttpRequest.js", so the built file won't include
the XMLHttpRequest code, which is problematic.

Adding "@require OpenLayers/Request/XMLHttpRequest.js" to Request.js
comes up with its own problem: a circular reference. Yes,
XMLHttpRequest.js does include "@require OpenLayers/Request.js". And
if we remove that @require in XMLHttpRequest.js, it doesn't work
either, because XMLHttpRequest.js does require Request.js when its
main anonymous function is executed.

One solution to this entire issue might be use

 * @requires OpenLayers/Request/XMLHttpRequest.js

everywhere the Request object is used. But it's a bit confusing.

Any other idea?


More information about the Dev mailing list