AnsweredAssumed Answered

execute a function in another file

Question asked by roialga on Jul 28, 2015

Hello,

I am trying to add buttons that will change the tour point layer in the storytelling templates. To do so I am trying to add a button that will send a parameter and activate a function in another js file. (I am not sure for a 100% that this is the right way, but I do think that this may be the way).

I am trying that this button:

<button onclick="myFunction()">button check</button>;             

<script>

function myFunction() {

          require(["storymaps/maptour/core/MainView"],function(MainView){

               MainView.webmapLoaded();

          });

};

</script>

will go to the mainView js file and activate the webmapLoded function.

The webmapLoaded function is written like this:

this.webmapLoaded = function()

{function code};

And it is sitting inside a:

return function MainView()

{function code}

I know this may be a basic knowledge that I am missing, I am trying to teach myself programing and JavaScript.

And I thank you very much for your help.

Outcomes