Hello!
What I want to do is when I call the method , It runs and takes 3 seconds to finish the method.
While this 3 seconds , even trying to call this method again, It can not.
After 3 seconds this can be called again.
Something like this should work.
It will prevent the method from being called if it is already running:
var IsMyMethodRunning: logic = false
MyMethod():void=
if (IsMyMethodRunning?):
return
set IsMyMethodRunning = true
defer:
set IsMyMethodRunning = false
# Put the actual code you want to run here