@saschabrunnerch/arcgis-maps-sdk-js-ai-context 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +163 -203
  2. package/bin/cli.js +157 -173
  3. package/contexts/4.34/{claude → skills}/arcgis-3d-advanced/SKILL.md +586 -586
  4. package/contexts/4.34/{claude → skills}/arcgis-advanced-layers/SKILL.md +431 -431
  5. package/contexts/4.34/{claude → skills}/arcgis-analysis-services/SKILL.md +607 -607
  6. package/contexts/4.34/{claude → skills}/arcgis-authentication/SKILL.md +301 -301
  7. package/contexts/4.34/{claude → skills}/arcgis-cim-symbols/SKILL.md +486 -486
  8. package/contexts/4.34/{claude → skills}/arcgis-coordinates-projection/SKILL.md +406 -406
  9. package/contexts/4.34/{claude → skills}/arcgis-core-maps/SKILL.md +739 -739
  10. package/contexts/4.34/{claude → skills}/arcgis-core-utilities/SKILL.md +732 -732
  11. package/contexts/4.34/{claude → skills}/arcgis-custom-rendering/SKILL.md +445 -445
  12. package/contexts/4.34/{claude → skills}/arcgis-editing-advanced/SKILL.md +702 -702
  13. package/contexts/4.34/{claude → skills}/arcgis-feature-effects/SKILL.md +393 -393
  14. package/contexts/4.34/{claude → skills}/arcgis-geometry-operations/SKILL.md +489 -489
  15. package/contexts/4.34/{claude → skills}/arcgis-imagery/SKILL.md +307 -307
  16. package/contexts/4.34/{claude → skills}/arcgis-interaction/SKILL.md +572 -572
  17. package/contexts/4.34/{claude → skills}/arcgis-knowledge-graphs/SKILL.md +582 -582
  18. package/contexts/4.34/{claude → skills}/arcgis-layers/SKILL.md +601 -601
  19. package/contexts/4.34/{claude → skills}/arcgis-map-tools/SKILL.md +668 -668
  20. package/contexts/4.34/{claude → skills}/arcgis-media-layers/SKILL.md +290 -290
  21. package/contexts/4.34/{claude → skills}/arcgis-portal-content/SKILL.md +679 -679
  22. package/contexts/4.34/{claude → skills}/arcgis-scene-effects/SKILL.md +512 -512
  23. package/contexts/4.34/{claude → skills}/arcgis-smart-mapping/SKILL.md +686 -686
  24. package/contexts/4.34/{claude → skills}/arcgis-starter-app-extended/SKILL.md +649 -649
  25. package/contexts/4.34/{claude → skills}/arcgis-tables-forms/SKILL.md +877 -877
  26. package/contexts/4.34/{claude → skills}/arcgis-time-animation/SKILL.md +722 -722
  27. package/contexts/4.34/{claude → skills}/arcgis-utility-networks/SKILL.md +301 -301
  28. package/contexts/4.34/{claude → skills}/arcgis-visualization/SKILL.md +580 -580
  29. package/contexts/4.34/{claude → skills}/arcgis-widgets-ui/SKILL.md +574 -574
  30. package/lib/installer.js +19 -104
  31. package/package.json +45 -45
  32. package/contexts/4.34/copilot/arcgis-3d.instructions.md +0 -267
  33. package/contexts/4.34/copilot/arcgis-analysis.instructions.md +0 -294
  34. package/contexts/4.34/copilot/arcgis-arcade.instructions.md +0 -234
  35. package/contexts/4.34/copilot/arcgis-authentication.instructions.md +0 -187
  36. package/contexts/4.34/copilot/arcgis-cim-symbols.instructions.md +0 -177
  37. package/contexts/4.34/copilot/arcgis-core-maps.instructions.md +0 -246
  38. package/contexts/4.34/copilot/arcgis-core-utilities.instructions.md +0 -247
  39. package/contexts/4.34/copilot/arcgis-editing.instructions.md +0 -262
  40. package/contexts/4.34/copilot/arcgis-geometry.instructions.md +0 -225
  41. package/contexts/4.34/copilot/arcgis-layers.instructions.md +0 -278
  42. package/contexts/4.34/copilot/arcgis-popup-templates.instructions.md +0 -266
  43. package/contexts/4.34/copilot/arcgis-portal-advanced.instructions.md +0 -275
  44. package/contexts/4.34/copilot/arcgis-smart-mapping.instructions.md +0 -184
  45. package/contexts/4.34/copilot/arcgis-starter-app-extended.instructions.md +0 -643
  46. package/contexts/4.34/copilot/arcgis-starter-app.instructions.md +0 -268
  47. package/contexts/4.34/copilot/arcgis-time-animation.instructions.md +0 -112
  48. package/contexts/4.34/copilot/arcgis-visualization.instructions.md +0 -321
  49. package/contexts/4.34/copilot/arcgis-widgets-ui.instructions.md +0 -277
  50. /package/contexts/4.34/{claude → skills}/arcgis-arcade/SKILL.md +0 -0
  51. /package/contexts/4.34/{claude → skills}/arcgis-popup-templates/SKILL.md +0 -0
  52. /package/contexts/4.34/{claude → skills}/arcgis-starter-app/SKILL.md +0 -0
@@ -1,177 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - CIM Symbols
6
-
7
- Advanced cartographic symbols using CIM (Cartographic Information Model).
8
-
9
- ## Basic CIM Symbol
10
-
11
- ```javascript
12
- const graphic = new Graphic({
13
- geometry: point,
14
- symbol: {
15
- type: "cim",
16
- data: {
17
- type: "CIMSymbolReference",
18
- symbol: {
19
- type: "CIMPointSymbol",
20
- symbolLayers: [{
21
- type: "CIMVectorMarker",
22
- enable: true,
23
- size: 20,
24
- frame: { xmin: 0, ymin: 0, xmax: 10, ymax: 10 },
25
- markerGraphics: [{
26
- type: "CIMMarkerGraphic",
27
- geometry: { rings: [[[0,0], [10,0], [10,10], [0,10], [0,0]]] },
28
- symbol: {
29
- type: "CIMPolygonSymbol",
30
- symbolLayers: [{
31
- type: "CIMSolidFill",
32
- enable: true,
33
- color: [255, 0, 0, 255]
34
- }]
35
- }
36
- }]
37
- }]
38
- }
39
- }
40
- }
41
- });
42
- ```
43
-
44
- ## CIM Line Symbol (Arrow)
45
-
46
- ```javascript
47
- const arrowLineCIM = {
48
- type: "CIMSymbolReference",
49
- symbol: {
50
- type: "CIMLineSymbol",
51
- symbolLayers: [
52
- {
53
- type: "CIMVectorMarker",
54
- enable: true,
55
- size: 12,
56
- markerPlacement: {
57
- type: "CIMMarkerPlacementAtExtremities",
58
- extremityPlacement: "JustEnd",
59
- angleToLine: true
60
- },
61
- frame: { xmin: 0, ymin: 0, xmax: 10, ymax: 10 },
62
- markerGraphics: [{
63
- type: "CIMMarkerGraphic",
64
- geometry: { rings: [[[0, 0], [10, 5], [0, 10], [3, 5], [0, 0]]] },
65
- symbol: {
66
- type: "CIMPolygonSymbol",
67
- symbolLayers: [{ type: "CIMSolidFill", enable: true, color: [0, 0, 0, 255] }]
68
- }
69
- }]
70
- },
71
- { type: "CIMSolidStroke", enable: true, width: 2, color: [0, 0, 0, 255] }
72
- ]
73
- }
74
- };
75
- ```
76
-
77
- ## CIM Polygon Symbol (Hatched)
78
-
79
- ```javascript
80
- const hatchedFillCIM = {
81
- type: "CIMSymbolReference",
82
- symbol: {
83
- type: "CIMPolygonSymbol",
84
- symbolLayers: [
85
- {
86
- type: "CIMHatchFill",
87
- enable: true,
88
- lineSymbol: {
89
- type: "CIMLineSymbol",
90
- symbolLayers: [{ type: "CIMSolidStroke", enable: true, width: 1, color: [0, 0, 0, 255] }]
91
- },
92
- rotation: 45,
93
- separation: 5
94
- },
95
- { type: "CIMSolidFill", enable: true, color: [255, 255, 200, 255] },
96
- { type: "CIMSolidStroke", enable: true, width: 2, color: [0, 0, 0, 255] }
97
- ]
98
- }
99
- };
100
- ```
101
-
102
- ## Data-Driven CIM
103
-
104
- ```javascript
105
- const dataDrivenCIM = {
106
- type: "CIMSymbolReference",
107
- primitiveOverrides: [{
108
- type: "CIMPrimitiveOverride",
109
- primitiveName: "fillLayer",
110
- propertyName: "Color",
111
- valueExpressionInfo: {
112
- type: "CIMExpressionInfo",
113
- expression: `
114
- var val = $feature.value;
115
- if (val < 50) return [255, 0, 0, 255];
116
- return [0, 255, 0, 255];
117
- `,
118
- returnType: "Default"
119
- }
120
- }],
121
- symbol: {
122
- type: "CIMPointSymbol",
123
- symbolLayers: [{
124
- type: "CIMVectorMarker",
125
- markerGraphics: [{
126
- type: "CIMMarkerGraphic",
127
- symbol: {
128
- type: "CIMPolygonSymbol",
129
- symbolLayers: [{
130
- type: "CIMSolidFill",
131
- primitiveName: "fillLayer",
132
- color: [128, 128, 128, 255]
133
- }]
134
- }
135
- }]
136
- }]
137
- }
138
- };
139
- ```
140
-
141
- ## Marker Placement
142
-
143
- ```javascript
144
- // Along line
145
- markerPlacement: {
146
- type: "CIMMarkerPlacementAlongLineSameSize",
147
- placementTemplate: [20],
148
- angleToLine: true
149
- }
150
-
151
- // At vertices
152
- markerPlacement: {
153
- type: "CIMMarkerPlacementAtRatioPositions",
154
- positionArray: [0, 0.5, 1],
155
- angleToLine: true
156
- }
157
- ```
158
-
159
- ## CIM Properties
160
-
161
- ```javascript
162
- // Colors: [R, G, B, A] where each is 0-255
163
- color: [255, 0, 0, 255]
164
-
165
- // Stroke
166
- { type: "CIMSolidStroke", width: 2, color: [0, 0, 0, 255], capStyle: "Round", joinStyle: "Round" }
167
-
168
- // Anchor
169
- { anchorPoint: { x: 0, y: -0.5 }, anchorPointUnits: "Relative" }
170
- ```
171
-
172
- ## Common Pitfalls
173
-
174
- 1. **Frame coordinates** - Frame defines coordinate space for graphics
175
- 2. **Layer order** - Renders bottom to top
176
- 3. **Primitive names** - Must be unique for overrides
177
- 4. **Closed rings** - First point must equal last point
@@ -1,246 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - Core Maps & Views
6
-
7
- ## SDK Version
8
- Use ArcGIS Maps SDK for JavaScript version 4.x (currently 4.34).
9
-
10
- ## Import Patterns
11
-
12
- ### Direct ESM Imports (Recommended for Build Tools)
13
- ```javascript
14
- import Map from "@arcgis/core/Map.js";
15
- import MapView from "@arcgis/core/views/MapView.js";
16
- import SceneView from "@arcgis/core/views/SceneView.js";
17
- import WebMap from "@arcgis/core/WebMap.js";
18
- import WebScene from "@arcgis/core/WebScene.js";
19
- ```
20
-
21
- ### Dynamic Imports (CDN / No Build Tools)
22
- ```javascript
23
- const Map = await $arcgis.import("@arcgis/core/Map.js");
24
- const MapView = await $arcgis.import("@arcgis/core/views/MapView.js");
25
- ```
26
-
27
- ## Two Approaches: Map Components vs Core API
28
-
29
- ### Map Components (Modern - Recommended)
30
- ```html
31
- <arcgis-map basemap="topo-vector" center="-118.24,34.05" zoom="12">
32
- <arcgis-zoom slot="top-left"></arcgis-zoom>
33
- <arcgis-compass slot="top-left"></arcgis-compass>
34
- </arcgis-map>
35
-
36
- <script type="module">
37
- const mapElement = document.querySelector("arcgis-map");
38
- await mapElement.viewOnReady();
39
- const view = mapElement.view;
40
- const map = mapElement.map;
41
- </script>
42
- ```
43
-
44
- ### Core API
45
- ```javascript
46
- import Map from "@arcgis/core/Map.js";
47
- import MapView from "@arcgis/core/views/MapView.js";
48
-
49
- const map = new Map({ basemap: "topo-vector" });
50
-
51
- const view = new MapView({
52
- container: "viewDiv",
53
- map: map,
54
- center: [-118.24, 34.05], // [longitude, latitude]
55
- zoom: 12
56
- });
57
- ```
58
-
59
- ## CDN Setup
60
-
61
- ### Map Components
62
- ```html
63
- <script type="module" src="https://js.arcgis.com/calcite-components/3.3.3/calcite.esm.js"></script>
64
- <script src="https://js.arcgis.com/4.34/"></script>
65
- <script type="module" src="https://js.arcgis.com/4.34/map-components/"></script>
66
- ```
67
-
68
- ### Core API (requires CSS)
69
- ```html
70
- <link rel="stylesheet" href="https://js.arcgis.com/4.34/esri/themes/light/main.css" />
71
- <script src="https://js.arcgis.com/4.34/"></script>
72
- ```
73
-
74
- ## 2D Maps
75
-
76
- ```javascript
77
- const map = new Map({ basemap: "streets-vector" });
78
-
79
- const view = new MapView({
80
- container: "viewDiv",
81
- map: map,
82
- center: [-118.24, 34.05],
83
- zoom: 12,
84
- constraints: {
85
- minZoom: 5,
86
- maxZoom: 18,
87
- rotationEnabled: false
88
- }
89
- });
90
- ```
91
-
92
- ## 3D Scenes
93
-
94
- ```javascript
95
- import SceneView from "@arcgis/core/views/SceneView.js";
96
-
97
- const map = new Map({
98
- basemap: "topo-3d",
99
- ground: "world-elevation"
100
- });
101
-
102
- const view = new SceneView({
103
- container: "viewDiv",
104
- map: map,
105
- camera: {
106
- position: {
107
- longitude: -118.24,
108
- latitude: 34.05,
109
- z: 25000
110
- },
111
- heading: 0,
112
- tilt: 45
113
- }
114
- });
115
- ```
116
-
117
- ## Loading WebMaps and WebScenes
118
-
119
- ```javascript
120
- import WebMap from "@arcgis/core/WebMap.js";
121
- import WebScene from "@arcgis/core/WebScene.js";
122
-
123
- // WebMap
124
- const webmap = new WebMap({
125
- portalItem: { id: "f2e9b762544945f390ca4ac3671cfa72" }
126
- });
127
-
128
- // WebScene
129
- const webscene = new WebScene({
130
- portalItem: { id: "YOUR_WEBSCENE_ID" }
131
- });
132
- ```
133
-
134
- ## Navigation
135
-
136
- ```javascript
137
- // Go to location
138
- await view.goTo({
139
- center: [-118.24, 34.05],
140
- zoom: 15
141
- });
142
-
143
- // Animated navigation
144
- await view.goTo(
145
- { center: [-118.24, 34.05], zoom: 15 },
146
- { duration: 2000, easing: "ease-in-out" }
147
- );
148
-
149
- // Go to extent or features
150
- await view.goTo(layer.fullExtent);
151
- await view.goTo(featureSet.features);
152
- ```
153
-
154
- ## View Constraints
155
-
156
- ```javascript
157
- view.constraints = {
158
- minZoom: 5,
159
- maxZoom: 18,
160
- geometry: layer.fullExtent,
161
- rotationEnabled: false
162
- };
163
- ```
164
-
165
- ## Event Handling
166
-
167
- ```javascript
168
- // View ready
169
- view.when(() => console.log("View is ready"));
170
-
171
- // Click event
172
- view.on("click", (event) => {
173
- console.log("Clicked at:", event.mapPoint);
174
- });
175
-
176
- // Pointer move
177
- view.on("pointer-move", (event) => {
178
- const point = view.toMap(event);
179
- });
180
-
181
- // Watch properties
182
- view.watch("extent", (extent) => console.log("Extent changed"));
183
- view.watch("stationary", (isStationary) => {
184
- if (isStationary) console.log("Navigation complete");
185
- });
186
- ```
187
-
188
- ## Common Basemaps
189
-
190
- | ID | Description |
191
- |----|-------------|
192
- | `streets-vector` | Street map |
193
- | `topo-vector` | Topographic |
194
- | `satellite` | Satellite imagery |
195
- | `hybrid` | Satellite with labels |
196
- | `dark-gray-vector` | Dark gray canvas |
197
- | `gray-vector` | Light gray canvas |
198
- | `topo-3d` | 3D topographic |
199
-
200
- ## reactiveUtils (Property Watching)
201
-
202
- ```javascript
203
- import reactiveUtils from "@arcgis/core/core/reactiveUtils.js";
204
-
205
- reactiveUtils.watch(
206
- () => view.scale,
207
- (scale) => console.log("Scale:", scale)
208
- );
209
-
210
- reactiveUtils.when(
211
- () => layer.loaded,
212
- () => console.log("Layer loaded")
213
- );
214
- ```
215
-
216
- ## Autocasting vs Explicit Classes
217
-
218
- ### Use Autocasting for Configuration
219
- ```javascript
220
- layer.renderer = {
221
- type: "simple",
222
- symbol: { type: "simple-marker", color: "red" }
223
- };
224
- ```
225
-
226
- ### Use Explicit Classes for Instance Methods
227
- ```javascript
228
- import SimpleRenderer from "@arcgis/core/renderers/SimpleRenderer.js";
229
- const renderer = new SimpleRenderer({ ... });
230
- ```
231
-
232
- ### TypeScript: Use `as const`
233
- ```typescript
234
- layer.renderer = {
235
- type: "simple",
236
- symbol: { type: "simple-marker", color: "red" }
237
- } as const;
238
- ```
239
-
240
- ## Common Pitfalls
241
-
242
- 1. **Missing CSS for Core API** - Always include main.css
243
- 2. **Not awaiting viewOnReady()** - Wait before accessing view properties
244
- 3. **Coordinate order** - ArcGIS uses [longitude, latitude], not [lat, lon]
245
- 4. **Missing container height** - Ensure `#viewDiv { height: 100%; }`
246
- 5. **Script type** - Use `type="module"` for async/await
@@ -1,247 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - Core Utilities & Interaction
6
-
7
- ## reactiveUtils (Property Watching)
8
-
9
- ```javascript
10
- import reactiveUtils from "@arcgis/core/core/reactiveUtils.js";
11
-
12
- // Watch property
13
- const handle = reactiveUtils.watch(
14
- () => view.scale,
15
- (scale) => console.log("Scale:", scale)
16
- );
17
-
18
- // Watch with initial value
19
- reactiveUtils.watch(
20
- () => view.extent,
21
- (extent) => console.log("Extent:", extent),
22
- { initial: true }
23
- );
24
-
25
- // Wait for condition
26
- await reactiveUtils.when(() => view.ready);
27
-
28
- // One-time watch
29
- await reactiveUtils.once(() => layer.loaded);
30
-
31
- // Watch multiple
32
- reactiveUtils.watch(
33
- () => [view.center, view.zoom],
34
- ([center, zoom]) => console.log(center, zoom)
35
- );
36
-
37
- // Stop watching
38
- handle.remove();
39
- ```
40
-
41
- ## Handles (Cleanup)
42
-
43
- ```javascript
44
- import Handles from "@arcgis/core/core/Handles.js";
45
-
46
- const handles = new Handles();
47
-
48
- handles.add(reactiveUtils.watch(() => view.scale, () => {}));
49
- handles.add(view.on("click", () => {}), "click-group");
50
-
51
- // Remove group
52
- handles.remove("click-group");
53
-
54
- // Remove all
55
- handles.removeAll();
56
- handles.destroy();
57
- ```
58
-
59
- ## promiseUtils
60
-
61
- ```javascript
62
- import promiseUtils from "@arcgis/core/core/promiseUtils.js";
63
-
64
- // Debounce
65
- const debouncedSearch = promiseUtils.debounce(async (query) => {
66
- return await searchService.search(query);
67
- });
68
-
69
- // Throttle
70
- const throttledUpdate = promiseUtils.throttle(async (extent) => {
71
- await updateDisplay(extent);
72
- }, 100);
73
-
74
- // Check abort error
75
- try {
76
- await debouncedSearch(query);
77
- } catch (e) {
78
- if (!promiseUtils.isAbortError(e)) throw e;
79
- }
80
-
81
- // Wait for all (regardless of success)
82
- const results = await promiseUtils.eachAlways([promise1, promise2]);
83
- results.forEach(r => console.log(r.error || r.value));
84
- ```
85
-
86
- ## Collection
87
-
88
- ```javascript
89
- import Collection from "@arcgis/core/core/Collection.js";
90
-
91
- const collection = new Collection([item1, item2]);
92
-
93
- // Mutate
94
- collection.add(item);
95
- collection.addMany([item3, item4]);
96
- collection.remove(item);
97
- collection.removeAt(0);
98
- collection.removeAll();
99
- collection.reorder(item, 0);
100
-
101
- // Query
102
- const found = collection.find(item => item.id === 3);
103
- const filtered = collection.filter(item => item.active);
104
- const mapped = collection.map(item => item.name);
105
-
106
- // Events
107
- collection.on("change", (e) => {
108
- console.log("Added:", e.added, "Removed:", e.removed);
109
- });
110
- ```
111
-
112
- ## Hit Testing
113
-
114
- ```javascript
115
- view.on("click", async (event) => {
116
- const response = await view.hitTest(event);
117
- if (response.results.length > 0) {
118
- const graphic = response.results[0].graphic;
119
- console.log("Clicked:", graphic.attributes);
120
- }
121
- });
122
-
123
- // Filter by layer
124
- const response = await view.hitTest(event, {
125
- include: [featureLayer],
126
- exclude: [graphicsLayer]
127
- });
128
- ```
129
-
130
- ## Highlighting
131
-
132
- ```javascript
133
- const layerView = await view.whenLayerView(featureLayer);
134
-
135
- // Highlight
136
- const highlight = layerView.highlight(graphic);
137
- const highlight = layerView.highlight([graphic1, graphic2]);
138
- const highlight = layerView.highlight([objectId1, objectId2]);
139
-
140
- // Remove highlight
141
- highlight.remove();
142
-
143
- // Options
144
- layerView.highlightOptions = {
145
- color: [255, 255, 0, 1],
146
- haloOpacity: 0.9,
147
- fillOpacity: 0.2
148
- };
149
- ```
150
-
151
- ## View Events
152
-
153
- ```javascript
154
- // Click
155
- view.on("click", (event) => {
156
- console.log("Map point:", event.mapPoint);
157
- console.log("Screen:", event.x, event.y);
158
- });
159
-
160
- // Double-click
161
- view.on("double-click", (event) => {
162
- event.stopPropagation(); // Prevent zoom
163
- });
164
-
165
- // Pointer move
166
- view.on("pointer-move", (event) => {
167
- const point = view.toMap(event);
168
- });
169
-
170
- // Key events
171
- view.on("key-down", (event) => {
172
- if (event.key === "Escape") { }
173
- });
174
-
175
- // Stationary (navigation complete)
176
- view.watch("stationary", (isStationary) => {
177
- if (isStationary) console.log("Navigation done");
178
- });
179
- ```
180
-
181
- ## Coordinate Conversion
182
-
183
- ```javascript
184
- // Screen to map
185
- const mapPoint = view.toMap({ x: screenX, y: screenY });
186
-
187
- // Map to screen
188
- const screenPoint = view.toScreen(mapPoint);
189
- ```
190
-
191
- ## Units
192
-
193
- ```javascript
194
- import units from "@arcgis/core/core/units.js";
195
-
196
- const meters = units.convertUnit(100, "feet", "meters");
197
- const sqKm = units.convertUnit(1000, "acres", "square-kilometers");
198
- ```
199
-
200
- ## Scheduling
201
-
202
- ```javascript
203
- import scheduling from "@arcgis/core/core/scheduling.js";
204
-
205
- const handle = scheduling.addFrameTask({
206
- update: (event) => {
207
- console.log("Delta:", event.deltaTime);
208
- }
209
- });
210
-
211
- handle.remove();
212
- ```
213
-
214
- ## Workers (Background Processing)
215
-
216
- ```javascript
217
- import workers from "@arcgis/core/core/workers.js";
218
-
219
- const connection = await workers.open("path/to/worker.js");
220
- const result = await connection.invoke("methodName", { data: "params" });
221
- connection.close();
222
- ```
223
-
224
- ## Accessor (Custom Classes)
225
-
226
- ```javascript
227
- import Accessor from "@arcgis/core/core/Accessor.js";
228
- import { subclass, property } from "@arcgis/core/core/accessorSupport/decorators.js";
229
-
230
- @subclass("myapp.CustomClass")
231
- class CustomClass extends Accessor {
232
- @property()
233
- name = "default";
234
-
235
- @property({ readOnly: true, dependsOn: ["name"] })
236
- get displayName() {
237
- return this.name.toUpperCase();
238
- }
239
- }
240
- ```
241
-
242
- ## Common Pitfalls
243
-
244
- 1. **Memory leaks** - Always remove handles when done
245
- 2. **Initial value** - Use `{ initial: true }` for immediate callback
246
- 3. **Abort errors** - Check with `promiseUtils.isAbortError()`
247
- 4. **Sync vs async** - Default is async batching, `{ sync: true }` for immediate