[OpenLayers-Users] Unable to understand the Initialize code?

Phil Scadden p.scadden at gns.cri.nz
Thu Aug 9 18:40:40 PDT 2012


> was the 'arguments' variable which was passed in the prototype,
Standard javascript. See 
http://www.sitepoint.com/arguments-a-javascript-oddity/ for more 
explanation.
>
> Also, what does 'options && options.handlerOptions || {}' mean in,
This says "if options is not null and options.handlerOptions is not 
null, return options.handlerOption, else return an empty object". Think 
about how a null object works in a boolean expression in JS. This 
ensures an empty object rather than a null is passed to the Extend 
function, which combines it with the defaultHandlerOptions. The code 
intent is to combine any passed in handler options with the default
> And finally what is the significance of including this,
>
>  CLASS_NAME: "OpenLayers.Control.Click"
JS lacks a formal class structure. Any functions can serve as template 
for creating objects. Openlayers way of creating  a simple class 
structure can be found in Class.js code.
Part of the convention is to add property CLASS_NAME to function 
designed to be an OL class with the class name in it.


Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.



More information about the Users mailing list