OpenLayers OpenLayers

Changeset 354

Show
Ignore:
Timestamp:
05/25/06 07:01:51 (3 years ago)
Author:
follower
Message:

Instead of duplicating code we now enable OpenLayers.js to be used in both the Single File Library build and the dynamic load version. A SFL build is now indicated by way of the existence of a _OPENLAYERS_SFL_ flag. Instead of using a try/catch block to avoid polluting the global namespace the dynamic load code now uses an anonymous function. The dynamic loading code also no longer checks for the existence of OpenLayers.Map, it will now always run when it is not in a SFL build.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/follower/b-singlefile/lib/OpenLayers.js

    r278 r354  
    3232} 
    3333 
    34 try{new OpenLayers.Map();} 
    35 catch(e){ 
     34/* 
     35  `_OPENLAYERS_SFL_` is a flag indicating this file is being included 
     36  in a Single File Library build of the OpenLayers Library. 
     37 
     38  When we are *not* part of a SFL build we dynamically include the 
     39  OpenLayers library code. 
     40 
     41  When we *are* part of a SFL build we do not dynamically include the  
     42  OpenLayers library code as it will be appended at the end of this file. 
     43*/ 
     44if (typeof(_OPENLAYERS_SFL_) == "undefined") { 
     45    /* 
     46      The original code appeared to use a try/catch block 
     47      to avoid polluting the global namespace, 
     48      we now use a anonymous function to achieve the same result. 
     49     */ 
     50    (function() { 
    3651    var jsfiles=new Array( 
    3752        "Prototype.js",  
     
    7994    } 
    8095    document.write(allScriptTags); 
    81 }; 
     96    })(); 
     97