On Wednesday, February 15, 2012, Armin Burger wrote:
> Eric
>
> thanks. I saw some postings for this yesterday but did not get it to work,
> and thought it might not be fully functioning... Now I tried again - and
> succeeded... ;-)
>
> I could overwrite the function by adding the complete original code and
> afterwards the lines I needed for extending it. But I did not find any
> possibility to make a call to the original initialize function and then
> afterwards just the few lines to extend the function. But maybe this is not
> possible
You can do this:
var f = A.prototype.f;
A.prototype.f = function() {
f.apply(this, arguments);
};
Or, using the overwrite function given in the tests:
var f = A.prototype.f;
A = overwrite(A, {
f: function() {
f.apply(this, arguments)(
}
});
Anyway, it's probably safer to subclass OpenLayers classes rather than
monkeypatching them like this.
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users