JavaScript and GGBScript

Ian SooHoo shared this question 4 months ago
Answered

Is there any way to run a set of GGBScripts from JavaScript Event Listeners in the Global JS section?


There is also a note at the bottom of the scripting page that states "Note: Using any ggbApplet methods in Global JavaScript outside of ggbOnInit will not work as intended since they will be called before the construction is loaded."


This means that any JS functions can only be used to create things like alert dialogs outside of ggbOnInit? As with regular JavaScript in a website, multiple files can be loaded and objects can be created and manipulated, but is it correct that JS does not interact with GeoGebra this way?

Comments (3)

photo
2

ggbApplet.evalCommand('RunClickScript(button1)');

photo
2

Using any ggbApplet methods in Global JavaScript outside of ggbOnInit will not work as intended


ie everything there should be in a function (not at "top" level)

photo
2

my example: I use a slider created by global and listener on update function name vista


so vista is executed after the construction is loaded; then vista is removed of listener

© 2019 International GeoGebra Institute