Ciao, è possibile mettere in pausa una funzione in setTimeout e poi riavviarla in base ad altri eventi?

Grazie