Is there a way to force a delay in a Scriptable script? I’m thinking of something akin to a sleep(1000) or wait command. I was trying to make a delay between consecutive 'Location.current()'s to get a direction.
I hope this isn’t off topic. Loving Scriptable, I’m having a lot of fun playing with it.
I tried to use setTimeout() but I’m not sure what I am doing wrong. I keep getting the error Error: ReferenceError: Can't find variable: setTimeout with the below code
// get finish location after 10s delay
function wait(){
setTimeout(function(){ Location.current() }, 10000)
}
let finish = wait()
My original code for getting locations, which worked but without delay, was
let finish = await Location.current()
I’ve not managed to find anything on why it isn’t working. Would anyone here have an idea?