Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to interrupt a script running EventLoop #50

Open
zllovesuki opened this issue Mar 6, 2023 · 3 comments
Open

No way to interrupt a script running EventLoop #50

zllovesuki opened this issue Mar 6, 2023 · 3 comments

Comments

@zllovesuki
Copy link

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.

@dop251
Copy link
Owner

dop251 commented Mar 8, 2023

Could you please provide a testcase?

@zllovesuki
Copy link
Author

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.

@dop251
Copy link
Owner

dop251 commented Mar 9, 2023

I see. Perhaps it's worth adding loop.Interrupt() which will do a combination of StopNoWait and vm.Interrupt.

@dop251 dop251 reopened this Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants