Is there a way to cancel a running delay function when switching the context?

Hello, Is there a way to cancel a running delay function when switching the context?

I have observed that delay function timer does not stop running when going/opening a different page. Even if this logic is part of a given page context (like data variable for instance).
Even worse if the delay value is long enough and I come back to the page which has the delay logic before the timeout expires I end up running 2 or more instances of the delay loop. @Mari, any idea? Voila; Piotr

I solved the problem of overlapping/overlaying and non-cancellable timers (a delay flow function) with the following information: Create a cancelable Promise delay in JavaScript.