quicksettings icon indicating copy to clipboard operation
quicksettings copied to clipboard

.addButton runs callback on load

Open garrett-laroy-johnson opened this issue 2 years ago • 0 comments

apologies in advance -- it's not clear to me whether this is a bug or simply my own user error:

I'm dynamically created quicksettings GUIs when a new JS object is made. When I use addButton(), the callback runs when the button is created. Significantly, the button is supposed to delete the object and the GUI -- so you can see my predicament. Is there a way to disable this, or something special with quicksettings?

my work around is the following:

let done = false;
gui.addButton("delete", deleteObj());
done = true;
function deleteObj(){
if (done){
 gui.remove();
}
}

garrett-laroy-johnson avatar Apr 06 '22 19:04 garrett-laroy-johnson