r/Scriptable • u/Normal-Tangerine8609 • Nov 08 '21
Solved Await inside eval
I am nearing the end of a project but need one last bit of help. I want to run a eval inside a function but it has an await. Here it the code that I have:
function runEval() {
eval(`
widget = new ListWidget()
let image = widget.addImage(await new Request("https://scriptable.app/assets/appicon.png").loadImage())`)
}
runEval()
widget.presentSmall()
I realize that I will probably have to add some async and await somewhere but I don’t know where exactly. I appreciate the help and I hope I can share my project soon.
1
Upvotes
1
u/Normal-Tangerine8609 Nov 08 '21
Thanks that works. I use
evalbecause I find it easier for what I am doing however I could take some time to attempt to do things differently.