Files
openlayers/src/ol/proj/projections.js
Tim Schaub ccfacc5ee6 Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e):

    jscodeshift --transform ts.js src
2018-09-05 08:05:29 -06:00

38 lines
685 B
JavaScript

/**
* @module ol/proj/projections
*/
/**
* @type {Object<string, import("./Projection.js").default>}
*/
let cache = {};
/**
* Clear the projections cache.
*/
export function clear() {
cache = {};
}
/**
* Get a cached projection by code.
* @param {string} code The code for the projection.
* @return {import("./Projection.js").default} The projection (if cached).
*/
export function get(code) {
return cache[code] || null;
}
/**
* Add a projection to the cache.
* @param {string} code The projection code.
* @param {import("./Projection.js").default} projection The projection to cache.
*/
export function add(code, projection) {
cache[code] = projection;
}