Doc
This commit is contained in:
parent
d970b288e4
commit
c800235ebb
|
@ -4,23 +4,20 @@ import { range, isEqual } from 'lodash';
|
|||
import { Rectangle, TileFactory, TileKeyObject } from './types';
|
||||
import tileUri from './uris';
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export const thisIsAModule = true;
|
||||
|
||||
/**
|
||||
* A cache to store tiles without being subject to re-initialization when components are unmounted/remounted.
|
||||
*
|
||||
* This cache is a map of map, the first key identifying the `<TiledLayer` and the second one for `<Tile>`s.
|
||||
*
|
||||
* Idea stolen [on the web](https://dev.to/tiagof/react-re-mounting-vs-re-rendering-lnh)
|
||||
*
|
||||
* TODO: housekeeping
|
||||
*
|
||||
*/
|
||||
|
||||
declare global {
|
||||
var cacheForTiledLayer: any;
|
||||
}
|
||||
|
||||
export {};
|
||||
//export {};
|
||||
|
||||
globalThis.cacheForTiledLayer = new Map();
|
||||
|
||||
|
@ -44,8 +41,17 @@ export interface TiledLayerProperties {
|
|||
* This component has no need to know the number nor the size of its tiles: tiles can be added when needed and
|
||||
* its unit is the tile size (the parent component needs to transform its enclosing SVG group to adapt its units)
|
||||
*
|
||||
* The `globalThis.cacheForTiledLayer` global variable is used as a cache to store tiles without being subject
|
||||
* to re-initialization when components are unmounted/remounted.
|
||||
*
|
||||
* This cache is a map of map, the first key identifying the `<TiledLayer` and the second one for `<Tile>`s.
|
||||
*
|
||||
* Idea stolen [on the web](https://dev.to/tiagof/react-re-mounting-vs-re-rendering-lnh)
|
||||
*
|
||||
* TODO: cache housekeeping
|
||||
*
|
||||
* TODO: test tiles'X and Y boundaries.
|
||||
* TODO: housekeeping
|
||||
*
|
||||
* TODO: remove tileFactory to facilitate memoisation.
|
||||
*
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue