[OpenLayers-Dev] 2.10 and 2.11-RC1 OpenLayers.Class behavior
changes
Eric Lemoine
eric.lemoine at camptocamp.com
Mon Aug 1 16:54:55 EDT 2011
On Sun, Jul 24, 2011 at 11:38 PM, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> Hi Didier,
>
> not sure if you've seen my follow-up mail. You need to re-assign the protoype after the snippet I posted. So the whole snippet would be:
>
> var X= OpenLayers.Class({
> initialize:function() { this._p= "A.initialize";
> OpenLayers.Console.info(this._p); },
> pa:"PA",
> p_:null,
> ma:function() { OpenLayers.Console.info("A.ma="+this.pa); }
> });
> xProto = X.prototype;
> xProto.initialize = function() { this.p_= "A.initialize-new";
> OpenLayers.Console.info(this.p_); }
> X = xProto.initialize;
> X.proto = xProto;
Is setting xProto.initialize mandatory? How about this little simplification:
var proto = X.prototype;
X = function() { /* new ctor */ };
X.prototype = proto;
?
I guess the same simplification should apply to Andreas' OverloadB snippet.
Cheers,
PS: BTW, I agree there's no regression here :-)
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
More information about the Dev
mailing list