AnsweredAssumed Answered

Cannot read property 'call' of undefined

Question asked by minnag on May 22, 2018
Latest reply on May 23, 2018 by minnag

My custom widget has a click event handler that works with a draw toolbar and a dojo deferred function to create a snapped point on a map. The tool is working well with no errors in functionality in the map but I am getting a console error that I can't get rid of. I can't figure out what is causing it. The error occurs after the console.log('end') and before the console.log('second end') (see code snippet below). Can anyone help me troubleshoot the cause of this error so I can get rid of it? Here is the error:


Uncaught TypeError: Cannot read property 'call' of undefined
at Object.<anonymous> (init.js:653)
at Object.c [as onClick] (init.js:119)
at Object._fire (init.js:1299)
at Object._fireClickEvent (init.js:1306)
at init.js:63
(anonymous) @ init.js:653
c @ init.js:119
_fire @ init.js:1299
_fireClickEvent @ init.js:1306
(anonymous) @ init.js:63
setTimeout (async)
_onClickHandler @ init.js:1305
(anonymous) @ init.js:63


Here is my code:


addtoMap: function(evt){

this.own(this.defmapClickEvtHandler ="click", lang.hitch(this, function(evt){;

var deferred =;

var sms = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_DIAMOND, 12,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([70, 0, 130, 1]), 1), new Color([70, 0, 130, 1]));

deferred.then(lang.hitch(this, function(value){

var point;

if (value !== undefined){
point = value;

} else {
point = evt.mapPoint;


var graphic = new Graphic(point, sms);;




console.log('second end');