How to have two functions for one button (Typescript)


#1

Hello guys,

How can I implement two functions for one button?

For instance, I would like to turn on something when I tab on button and then turn off something when I tab on it again.
Right now I have tutorials regarding implementing only one function to a button.

Any advice on this with a simple typescript example?

Please help me out

Thanks,


#2

Maybe there is a part of your question that I am missing, but why can’t you have a boolean flag that you toggle when the button fires. Then, based on the value of that flag you perform either function 1 or function 2?


#3

That makes sense… I will try it.

Any other opinion would be still appreciated.