My geogebra HTML execute multiple times all my Register Listeners

Yusbely Delgado shared this question 2 years ago
Needs Answer

These are my funcions definitions where "updateElementListenerFunction" is called multiple times, why?? NOTE: it happens with all the listeners, EVEN with the click on a button when the listener defined is about update event.


var myggbApplet = document.ggbApplet;

var someObject = {};

var jsonObjects = [];

var jsonString = "";

var veces = 0;


var resultado_correcto;

var pasos;

var ei;

var ed;

var casilla_a_evaluar;


function ggbOnInit(param) {

document.ggbApplet.registerObjectUpdateListener("c", "updateElementListenerFunction");

}


function updateElementListenerFunction() {

resultado_correcto = document.ggbApplet.getValue("d");

pasos = document.ggbApplet.getValue("b");

ei = document.ggbApplet.getValue("a");

ed = document.ggbApplet.getValue("c");


casilla_a_evaluar = ed;


someObject = {

EI: ei,

ED: ed,

pasos: pasos,

resultado: (casilla_a_evaluar == resultado_correcto) ? "MUY BIEN":"Revisa tus cálculos"

};


jsonObjects.push(someObject);

jsonString = JSON.stringify(jsonObjects);


}


function clic(){


alert("json: "+jsonString);

}


This is my applet parameters:


var parameters = {

"id": "ggbApplet",

"width":800,

"height":500,

"showMenuBar":false,

"showAlgebraInput":true,

"showToolBar":false,

"customToolBar":"0 39 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6",

"showToolBarHelp":true,

"showResetIcon":false,

"enableLabelDrags":false,

"enableShiftDragZoom":true,

"enableRightClick":false,

"errorDialogsActive":false,

"useBrowserForJS":true,

"allowStyleBar":false,

"preventFocus":false,

"showZoomButtons":true,

"capturingThreshold":3,

// add code here to run when the applet starts

"appletOnLoad":function(api){ /* api.evalCommand('Segment((1,2),(3,4))');*/ },

"showFullscreenButton":true,

"scale":1,

"disableAutoScale":false,

"allowUpscale":false,

"clickToLoad":false,

"appName":"classic",

"showSuggestionButtons":true,

"buttonRounding":0.7,

"buttonShadows":false,

"language":"es",

"material_id":"RHYH3UQ8",

}

Comments (2)

photo
1

Please post your file

photo
1

... and a link

© 2023 International GeoGebra Institute