Esri / storymap-shortlist

The Shortlist story map application template by Esri
http://storymaps.arcgis.com/en/app-list/shortlist/
Apache License 2.0
43 stars 61 forks source link

Subscribe to storymap events #89

Closed hhkaos closed 6 years ago

hhkaos commented 6 years ago

Hello there!

I'm trying to help one user on GeoNet to subscribe to events to this storymap but something is not working.

I have found three published events in the source code. I'm trying to subscribe to all of them but none of them seems to be the one I'm looking for:

topic.subscribe("story-tab-navigation", function(index){
     console.log(`Index = ${index}`);
     var data = {
          hitType: 'event',
          eventCategory: 'section',
          eventAction: 'story-tab-navigation',
          eventLabel: strip(app.data.getStory()[index].title).trim()
     };
     console.log('Sending data to GA: ', data);
     ga('send', data);
});

topic.subscribe("story-update-entries", function(arg){
     debugger
});

topic.subscribe("story-perform-action-media", function(arg){
     debugger
});

Mostly what I'm trying to find is the one triggered when a new tab is clicked, initially I though it was this one, but I'm not sure anymore.

@cooney could you help us with this?

Best regards, Raul

cooney commented 6 years ago

Hey Raul, Thanks for assisting on GeoNet. Unfortunately we do not currently have the tab navigation hooked up to publish (the one you reference is there, but the tab navigation via keyboard is not quite there yet). To hook up the tab click event and publishing the event, try plugging it in here: https://github.com/Esri/storymap-shortlist/blob/master/src/app/storymaps/tpl/ui/desktop/NavBar.js#L370.

We are planning on including this as a future enhancement (hopefully with the next release), to better help developers hook into this event to do fun stuff for each tab (turn supporting layers on/off, change map extent, etc.).

hhkaos commented 6 years ago

Thanks @cooney, I have made some changes to the template and I think it now works (but I'll have to fix the indentation at least... :sweat_smile:)

I'll let Kathy know on GeoNet, thanks!