Looking for advice on pass by value using dojo.connect and this.connect. I'm pretty sure there are some experts out there
I do get the connection made on each of the divs (e.g. hex_landing_A7) but when I click and get to the event handler (onLandInVolcano), the value of spot is always I4 (the last value of spot in the loop). It seems to be passing a reference to the spot variable rather than the value of spot at the time the connection is made. I want to use the spot value "A7" rather than a reference to the spot variable within the anonymous function.
What is the proper way to use variable values when creating dojo.connect linkages?
Thanks, Brian
Code: Select all
// during a loop, spot takes the values of A5,A6,A7,A8,B4,...,I2,I3,I4
dojo.connect( $("hex_landing_" + spot), "onclick", (e) => { this.onLandInVolcano(spot); }); What is the proper way to use variable values when creating dojo.connect linkages?
Thanks, Brian