MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / whenProjectionDefined

Method whenProjectionDefined

src/web-map.js:1499–1521  ·  view source on GitHub ↗
(projection)

Source from the content-addressed store, hash-verified

1497 return Promise.allSettled(layersReady);
1498 }
1499 whenProjectionDefined(projection) {
1500 return new Promise((resolve, reject) => {
1501 let interval, failureTimer;
1502 if (M[projection]) {
1503 resolve();
1504 } else {
1505 interval = setInterval(testForProjection, 200, projection);
1506 failureTimer = setTimeout(projectionNotDefined, 5000);
1507 }
1508 function testForProjection(p) {
1509 if (M[p]) {
1510 clearInterval(interval);
1511 clearTimeout(failureTimer);
1512 resolve();
1513 }
1514 }
1515 function projectionNotDefined() {
1516 clearInterval(interval);
1517 clearTimeout(failureTimer);
1518 reject('Timeout reached waiting for projection to be defined');
1519 }
1520 });
1521 }
1522 geojson2mapml(json, options = {}) {
1523 if (options.projection === undefined) {
1524 options.projection = this.projection;

Callers 4

projectionMethod · 0.95
connectedCallbackMethod · 0.95
connectedCallbackMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected