Skip to content

Instantly share code, notes, and snippets.

@apfister
Created October 25, 2017 14:10
Show Gist options
  • Save apfister/8c79396eb82c486273b3827743d4a22a to your computer and use it in GitHub Desktop.
Save apfister/8c79396eb82c486273b3827743d4a22a to your computer and use it in GitHub Desktop.
define(["dojo/topic"], function(topic) {
/*
* Custom Javascript to be executed while the application is initializing goes here
*/
// The application is ready
topic.subscribe("tpl-ready", function() {
/*
* Custom Javascript to be executed when the application is ready goes here
*/
});
var WEBMAP_ID = "fc3f658415c4400cb850ec8152c39561",
LAYER_ID = "TrailSegments_5706";
var clickHandlerIsSetup = false;
topic.subscribe("story-loaded-map", function (result) {
if (result.id == WEBMAP_ID && !clickHandlerIsSetup) {
var map = app.maps[result.id].response.map,
layer = map.getLayer(LAYER_ID);
if (layer) {
layer.on("click", function(e) {
var index = e.graphic.attributes["Index_"];
topic.publish("story-navigate-section", index);
});
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment