How to access the map object from browser console?

1977
11
03-18-2016 05:01 AM
BenedekSimó
New Contributor III

I would like to access the map object from my console (and maybe also widget objects). So far I could only make that by inserting a breakpoint in some widgets code and use the this.map option to get my maps properties. Is there a way to do that easier? (Exuse me if this is too straightforward...)

0 Kudos
11 Replies
ChrisSmith7
Frequent Contributor

You mentioned the browser's console - are you looking for more than this?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Chris,

I think he was asking how to access the map object and its properties from the consoles command line.

BenedekSimó
New Contributor III

That's right, Robert! Could you give me a hint maybe?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Benedek,

  Sure just use "window._widgetManager.map"

0 Kudos
BenedekSimó
New Contributor III

I could find window.__viewerMap for the map object!, and that's great! But still don't really know how to refer for widgets in the console...

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Benedek,

  If you use _widgetManager.getWidgetByLabel('Enhanced Search') when you have launched your app (not in the standard builder mode) then you can access the widget object.

0 Kudos
BenedekSimó
New Contributor III

Thank you Robert, but it seems I don't have a _widgetManager object. I am using WAB version 1.3 with v3.14 of the JS API.

ScreenShot182.png

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Benedek,

  Strange I get the _widget manager and am using the same WAB version. You will not be able to get the _widgetManager widgets without launching the app by clicking launch:

preview.jpg

0 Kudos
BenedekSimó
New Contributor III

I have clicked launch, but still no success... What am I doing wrong?ScreenShot184.png

0 Kudos