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

Method whenProjectionDefined

src/mapml-viewer.js:1456–1478  ·  view source on GitHub ↗
(projection)

Source from the content-addressed store, hash-verified

1454 return Promise.allSettled(layersReady);
1455 }
1456 whenProjectionDefined(projection) {
1457 return new Promise((resolve, reject) => {
1458 let interval, failureTimer;
1459 if (M[projection]) {
1460 resolve();
1461 } else {
1462 interval = setInterval(testForProjection, 200, projection);
1463 failureTimer = setTimeout(projectionNotDefined, 5000);
1464 }
1465 function testForProjection(p) {
1466 if (M[p]) {
1467 clearInterval(interval);
1468 clearTimeout(failureTimer);
1469 resolve();
1470 }
1471 }
1472 function projectionNotDefined() {
1473 clearInterval(interval);
1474 clearTimeout(failureTimer);
1475 reject('Timeout reached waiting for projection to be defined');
1476 }
1477 });
1478 }
1479 geojson2mapml(json, options = {}) {
1480 if (options.projection === undefined) {
1481 options.projection = this.projection;

Callers 3

projectionMethod · 0.95
connectedCallbackMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected