Select to view content in your preferred language

execute a function in another file

2719
0
07-28-2015 02:17 AM
roialgavish
New Contributor III

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.

0 Kudos
0 Replies