Closed brechtcs closed 5 years ago
Thanks for the feedback! Lemme know if there are any missing features you'd like, or if there's stuff in the TODO list that I should prioritize.
So, the main issue here is that Beaker doesn't really have a way to "close" an archive, and when you start participating in the Dat network, it starts up a local server for incoming connections which is what keeps everything running.
Basically, Webrun tries to behave the way a browser or web worker would. As long as the process is running, it'll stay alive. I tried to add some optimizations so we don't block the event loop in most cases, but when you start accepting incoming connections, I haven't really thought of a good way to represent that with web APIs.
What I've been doing to terminate scripts is to use the self.close()
API explicitly, which works the same way it would in a Worker or Window context in a browser.
Can confirm, a strategically placed window.close()
did the job for me. Thanks!
I am writing a recursive directory walking library specifically for
dat
archives and I'm using webrun to test against Beaker'sDatArchive
API. It seems though that scripts using this API in Webrun don't exit. I looked around for something equivalent todat-node
's close method, but couldn't find anything.If you want to see the code causing the problem, it's over here. But simply running this basic script reproduces the issue for me as well:
By the way, I'm very much enjoying Webrun. Finally a tool that allows me to experiment with Beaker features using Termux on my phone!