Skip to content

Commit 8e6de0a

Browse files
committed
More changes to the debugging snippets
1 parent 45cc82e commit 8e6de0a

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

debug-snippets/snippets.md

+5-26
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const view = require("esri/views/View").views.getItemAt(0);
1212

1313
```js
1414
view.map.allLayers.forEach((layer, index) => {
15-
console.log(index, " -> ", layer.title);
15+
console.log(`${index} -> ${layer.title}`);
1616
});
1717
```
1818

@@ -24,7 +24,7 @@ Step 1: check that the LayerView gets created
2424
const layer = view.map.allLayers.getItemAt(index);
2525

2626
view.whenLayerView(layer)
27-
.then(layerView => console.log(layerView))
27+
.then((layerView) => console.log(layerView))
2828
// if there were problems with the layerview, you'll get an error here
2929
.catch(console.error);
3030
```
@@ -100,35 +100,15 @@ You might need the extent to set a [clippingArea](https://developers.arcgis.com/
100100

101101
---
102102

103-
### ⌛ Show when a layer finished updating
104-
105-
```js
106-
107-
view.whenLayerView(layer)
108-
.then(layerView => {
109-
layerView.watch("updating", value => {
110-
if (!value) {
111-
console.log(`Layer ${layer.title} finished updating.`);
112-
}
113-
});
114-
})
115-
.catch(console.error);
116-
117-
```
118-
119-
---
120-
121103
### ⌛ Show when the view finished updating
122104

123105
```js
124106

125107
// works reliably only with version 4.12
126108

127-
view.when(() => {
128-
view.watch("updating", value => {
129-
const status = value ? "Updating" : "Finished updating"
130-
console.log(status);
131-
});
109+
view.watch("updating", (value) => {
110+
const status = value ? "is updating" : "finished updating";
111+
console.log(`View ${status}.`);
132112
});
133113

134114
```
@@ -157,4 +137,3 @@ view.when(() => {
157137
});
158138
});
159139
```
160-

0 commit comments

Comments
 (0)