<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><font face="Helvetica, Arial, sans-serif">Hi all,</font></p>
    <p>I extended the class ol.source.VectorTile in order to load
      VectorTiles in different formats (GeoJSON and MVT) from a local
      GWC cache. While upgrading from OpenLayers v3.20 to OpenLayers
      v4.x it seems that for MVT the scope in the "tileUrlFunction" gets
      lost. It seems to be "window". For GeoJSON-based VectorTiles
      everything is still running fine.</p>
    <p>Below you find the crutial parts of my class:</p>
    <p><tt>ol.inherits(ol.source.GWCVT, ol.source.VectorTile);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>ol.source.GWCVT.prototype.tileUrlFunction =</tt><tt><br>
      </tt><tt>    function(tileCoord, pixelRatio, projection) {</tt></p>
    <p><tt>// here 'this' becomes 'window' in the second call<br>
      </tt></p>
    <p><tt>// assembling the URL</tt><tt><br>
      </tt><tt>// ...</tt><tt><br>
      </tt></p>
    <p><tt>}</tt></p>
    <p><tt>ol.source.GWCVT.prototype.setTileUrlFunction =
        function(tileUrlFunction) {</tt><tt><br>
      </tt><tt><br>
      </tt><tt> 
        ol.source.VectorTile.prototype.setTileUrlFunction.call(this,
        tileUrlFunction);</tt><tt><br>
      </tt><tt>};</tt></p>
    <p>Thanks for any hint!</p>
    Cheers<br>
    Chris
  </body>
</html>