I have written my code to initiate the Sketch tools following way.
When the tool gets activated first time on click of the button (it's in my application, not the Sketch widget button) then it downloads several small javascript files and the tool related mouse cursor(crosshair) doesn't appear on the map immediately. This behavior is noticeable if you throttle the speed in Chrome to Slow 3G.
require(['esri/widgets/Sketch', 'esri/widgets/Sketch/SketchViewModel'], function(Sketch, SketchViewModel) {
var sketch = new Sketch({
defaultCreateOptions: {
mode: 'click'
},
layer: <graphic layer>,
updateOnGraphicClick: false,
view: mapView,
viewModel: new SketchViewModel({
pointSymbol: <pointSymbol>,
polylineSymbol: <polylineSymbol>
})
});
sketch.when(function(){
sketch.create(<tool>); //tool is point or polyline
});
});
Any idea on how to improve this performance or correct way to activate the tool so user doesn't require to wait?