Open zllovesuki opened 1 year ago
Could you please provide a testcase?
I was thinking that since *goja.Runtime
is only available in RunOnLoop()
, there's no way to invoke .Interrupt
. However it seems that I can keep the reference of Runtime and call Interrupt outside of RunOnLoop.
I will close this issue as it is user error.
I see. Perhaps it's worth adding loop.Interrupt() which will do a combination of StopNoWait and vm.Interrupt.
It doesn't seem like the Go code can interrupt a running job. The example in https://github.com/dop251/goja#interrupting cannot be replicated when a script is in an infinite loop inside of EventLoop.