Skip to content

Commit

Permalink
fix: remove async/await that uglify was choking on
Browse files Browse the repository at this point in the history
Fixes #72
  • Loading branch information
stdavis committed Jul 26, 2022
1 parent e549ece commit 6e38287
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
5 changes: 1 addition & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ module.exports = function (grunt) {
babel: {
options: {
sourceMap: true,
presets: [['@babel/preset-env', {
useBuiltIns: 'entry',
modules: false
}]],
presets: ['@babel/preset-env'],
plugins: ['transform-es2015-modules-simple-amd']
},
src: {
Expand Down
26 changes: 16 additions & 10 deletions _src/app/Toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ define([
'esri/geometry/projection',
'esri/graphic',
'esri/layers/GraphicsLayer',
'esri/SpatialReference',
'esri/symbols/SimpleFillSymbol',
'esri/symbols/SimpleLineSymbol',
'esri/tasks/query',
Expand Down Expand Up @@ -74,7 +73,6 @@ define([
projection,
Graphic,
GraphicsLayer,
SpatialReference,
SimpleFillSymbol,
SimpleLineSymbol,
Query,
Expand Down Expand Up @@ -322,23 +320,27 @@ define([
}));
topic.subscribe(config.topics.zoomToExtent, lang.hitch(this, 'zoomToExtent'));
},
async zoomToExtent(extent) {
zoomToExtent(extent) {
// summary:
// zooms the currently visible map to the given extent
// extent: Extent
console.log('app/Toolbox:zoomToExtent', arguments);

const map = this.getCurrentMap();

function finishUp() {
const projectedGeometry = projection.project(extent, map.spatialReference);
map.setExtent(projectedGeometry, true);
}

if (extent.spatialReference.wkid === map.spatialReference.wkid) {
map.setExtent(extent, true);
} else {
if (!projection.isLoaded()) {
await projection.load();
projection.load().then(finishUp);
}

const projectedGeometry = projection.project(extent, map.spatialReference);
map.setExtent(projectedGeometry, true);
finishUp();
}
},
addDrawingToMap: function (geometry) {
Expand Down Expand Up @@ -573,7 +575,7 @@ define([
this.previewMapUtm : this.previewMapWebMerc;
this.toggleMaps(this.map, activePreviewMap);
},
async toggleMaps(newMap, currentMap) {
toggleMaps(newMap, currentMap) {
// summary:
// description
// newMap: Map
Expand Down Expand Up @@ -606,15 +608,19 @@ define([
esriConfig.defaults.map.panDuration = that.defaultPanDuration;
};

function finishUp() {
const projectedGeometry = projection.project(currentMap.extent, newMap.spatialReference);
setExtent(projectedGeometry);
}

if (newMap.spatialReference.wkid === currentMap.spatialReference.wkid) {
setExtent(currentMap.extent);
} else {
if (!projection.isLoaded()) {
await projection.load();
projection.load().then(finishUp);
}

const projectedGeometry = projection.project(currentMap.extent, newMap.spatialReference);
setExtent(projectedGeometry);
finishUp();
}
},
getCurrentMap: function () {
Expand Down
4 changes: 2 additions & 2 deletions _src/app/app.profile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-undef, no-implicit-globals */
profile = {
// eslint-disable-next-line no-unused-vars
var profile = {
resourceTags: {
test: function (mid) {
return /\/Spec/.test(mid);
Expand Down

0 comments on commit 6e38287

Please sign in to comment.