[OpenLayers-Dev] Re: [OpenLayers 3] type instantiation performance

Eric Lemoine eric.lemoine at camptocamp.com
Fri Oct 22 04:12:54 EDT 2010


On Friday, October 22, 2010, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> It will be good to see this "pure JS" approach in action, with actual code. Especially how subclassing and instanceof checking for any class in the inheritance chain would work.

Just look at my OpenLayers.inherit function and the examples I provided.

Basically;

P = function() {
};
P.prototype = {
};
p = new P;
p instanceof P;

C = function() {
    P.call(this);
};
OpenLayers.inherit(C, P, {
});
c = new C;
c instanceof C;
c instanceof P;

-- 
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