Added Class.inherit, changed Class.create to make it unnecessary to check for arguments.length > 0 in initialize().
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1647 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,13 +4,35 @@
|
||||
|
||||
/* OpenLayers.Class metaclass */
|
||||
OpenLayers.Class = {
|
||||
create: function() {
|
||||
return function() {
|
||||
this.initialize.apply(this, arguments);
|
||||
isPrototype: function () {}, // magic anonymous value
|
||||
|
||||
create: function() {
|
||||
return function() {
|
||||
if (arguments && arguments[0] != OpenLayers.Class.isPrototype)
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
inherit: function () {
|
||||
var super = arguments[0];
|
||||
var proto = new super(OpenLayers.Class.isPrototype);
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
if (typeof arguments[i] == "function") {
|
||||
var mixin = arguments[i];
|
||||
arguments[i] = new mixin(OpenLayers.Class.isPrototype);
|
||||
}
|
||||
OpenLayers.Util.extend(proto, arguments[i]);
|
||||
}
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, OpenLayers.Layer.HTTPRequest, {
|
||||
some stuff
|
||||
});
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* *
|
||||
* PIXEL *
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<ul id="testlist">
|
||||
<li>test_Class.html</li>
|
||||
<li>test_Pixel.html</li>
|
||||
<li>test_Size.html</li>
|
||||
<li>test_LonLat.html</li>
|
||||
|
||||
Reference in New Issue
Block a user