[OpenLayers-Trac] [OpenLayers] #3483: Integration with javascript module loaders (AMD)

OpenLayers trac-20090302 at openlayers.org
Wed Aug 31 18:51:08 EDT 2011


#3483: Integration with javascript module loaders (AMD)
----------------------+-----------------------------------------------------
 Reporter:  aprilmay  |       Owner:              
     Type:  feature   |      Status:  new         
 Priority:  minor     |   Milestone:  2.12 Release
Component:  general   |     Version:  2.11 RC3    
 Keywords:            |       State:              
----------------------+-----------------------------------------------------
 _getScriptLocation works only if !OpenLayers is defined in a <script> tag,
 making the library incompatible with AMD's require(). In a practical case:
 we use Dojo 1.7 and have to load maps on demand.

 Tweaking _getScriptLocation is easy and everything works fine (hard code
 as quick and dirty workaround).
 It could be resolved elegantly by using an optional predefined
 configuration variable (olConfig, like Dojo's djConfig).

 Another related point, specific to Dojo: we had to register !OpenLayers
 explicitly in the global scope because of a security feature (with this
 solution: add "window.!OpenLayers=!OpenLayers" at the end of the main
 script).

 Finally, i feel that a library like !OpenLayers would greatly benefit from
 using extensively AMD specs: automatically loading required modules only,
 thus reducing the network load and improving the speed, permitting the use
 of flexible build systems, improving the integration with javascript
 frameworks and adding server side capabilities, among probably other
 advantages.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3483>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list