<br><br>On Wednesday, February 15, 2012, Armin Burger  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Eric<br>
<br>
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... ;-)<br>
<br>
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</blockquote>
<div><br></div><div>You can do this:</div><div><br></div><div>var f = A.prototype.f;</div><div>A.prototype.f = function() {</div><div>    f.apply(this, arguments);</div><div>};</div><div><br></div><div>Or, using the overwrite function given in the tests:</div>
<div><br></div><div>var f = A.prototype.f;</div><div>A = overwrite(A, {</div><div>    f: function() {</div><div>        f.apply(this, arguments)(</div><div>    }</div><div>});</div><div><br></div><div><br></div><div>Anyway, it&#39;s probably safer to subclass OpenLayers classes rather than monkeypatching them like this.</div>
<br><br>-- <br>Eric Lemoine<br><br>Camptocamp France SAS<br>Savoie Technolac, BP 352<br>73377 Le Bourget du Lac, Cedex<br><br>Tel : 00 33 4 79 44 44 96<br>Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com">http://www.camptocamp.com</a><br><br>