Skip to content

Commit

Permalink
Merge pull request #279 from Esri/update-import-style
Browse files Browse the repository at this point in the history
chore: updated import style
  • Loading branch information
Csmith246 authored Sep 7, 2023
2 parents f58dbe7 + 0a258a5 commit 7a8290f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion amd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "templates-common-library",
"version": "0.0.232",
"version": "0.0.266",
"files": [
"/*"
],
Expand Down
2 changes: 1 addition & 1 deletion esm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "templates-common-library",
"version": "0.0.232-esm",
"version": "0.0.266-esm",
"files": [
"/*"
],
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions src/baseClasses/support/itemUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ import {
parseLevel,
parseBasemap,
} from "./urlUtils";
import MapView from "esri/views/MapView";
import SceneView from "esri/views/SceneView";
import WebMap from "esri/WebMap";
import WebScene from "esri/WebScene";
import Search from "esri/widgets/Search";
import esri = __esri;
//--------------------------------------------------------------------------
//
Expand Down Expand Up @@ -94,11 +99,9 @@ export async function createView(
return Promise.reject(`map is not a "WebMap" or "WebScene"`);
}
if (isWebMap) {
const MapView = await import("esri/views/MapView");
return new MapView.default(properties);
return new MapView(properties);
} else {
const SceneView = await import("esri/views/SceneView");
return new SceneView.default(properties);
return new SceneView(properties);
}
}

Expand All @@ -122,8 +125,7 @@ export async function createWebMapFromItem(
options: CreateMapFromItemOptions
): Promise<esri.WebMap> {
const { item, appProxies, mapParams } = options;
const WebMap = await import("esri/WebMap");
const wm = new WebMap.default({
const wm = new WebMap({
portalItem: item,
...mapParams,
});
Expand All @@ -136,8 +138,7 @@ export async function createWebSceneFromItem(
options: CreateMapFromItemOptions
): Promise<esri.WebScene> {
const { item, appProxies } = options;
const WebScene = await import("esri/WebScene");
const ws = new WebScene.default({
const ws = new WebScene({
portalItem: item,
});
await ws.load();
Expand Down Expand Up @@ -207,9 +208,7 @@ export async function findQuery(
return Promise.resolve();
}

const Search = await import("esri/widgets/Search");

const search = new Search.default({
const search = new Search({
view,
});
const result = await search.search(query);
Expand Down

0 comments on commit 7a8290f

Please sign in to comment.