本文整理汇总了TypeScript中leaflet.TileLayer.addInitHook方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TileLayer.addInitHook方法的具体用法?TypeScript TileLayer.addInitHook怎么用?TypeScript TileLayer.addInitHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leaflet.TileLayer
的用法示例。
在下文中一共展示了TileLayer.addInitHook方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: done
return done();
}
return;
}
L.TileLayer.addInitHook(function(this: CachedTileLayer) {
this._checkLimitCounter = CHECK_LIMIT_COUNTER;
if (!this.options.useCache) {
this._db = null;
this._canvas = null;
return;
}
if (this.options.dbOptions) {
this._db = new PouchDB('offline-tiles', this.options.dbOptions);
} else {
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;
}
});
// đnamespace TileLayer
// đsection PouchDB tile caching options
// đoption useCache: Boolean = false
// Whether to use a PouchDB cache on this tile layer, or not
L.TileLayer.prototype.options.useCache = false;