L.TileLayer.addInitHook(function() { if (!this.options.useCache) { this._db = null; this._canvas = null; return; } this._db = new PouchDB('offline-tiles'); this._canvas = document.createElement('canvas'); if (!(this._canvas.getContext && this._canvas.getContext('2d'))) { // HTML5 canvas is needed to pack the tiles as base64 data. If // the browser doesn't support canvas, the code will forcefully // skip caching the tiles. this._canvas = null; } });
L.TileLayer.addInitHook(function() { if (!this.options.useCache) { this._db = null; this._canvas = null; return; } this._db = new PouchDB('offline-tiles'); this._canvas = document.createElement('canvas'); if (!(this._canvas.getContext && this._canvas.getContext('2d'))) { // HTML5 canvas is needed to pack the tiles as base64 data. If // the browser doesn't support canvas, the code will forcefully // skip caching the tiles. this._canvas = null; } });