AnsweredAssumed Answered

view.popup.watch being fired twice

Question asked by efranklingis on Jun 7, 2017
Latest reply on Jun 15, 2017 by rscheitlin

I am attempting to display my own custom popup when a user clicks on the MapImageLayer with the following code:

view.popup.watch("visible", function(visible) {
                view.popup.visible = false;
                if(visible){
                   var attr = view.popup.features[0].attributes;
                   $('.popup-table-container').remove();
                   var newPopup = formatPopup(attr);
                   $('body').append(newPopup);
                   $(newPopup).css({top: ($(window).height()/2)+'px',left: ($(window).width()/2)+'px'});
                }
            });

I try to close the default popup in the first line then second line I actually populate my own. I would like to stop this event from being fired twice with a single click, as a query is made twice which slows down the popup processing.

Outcomes