Closed siriuslee69 closed 4 months ago
Upon closing the window, after a while the other window will show up.
This is true, and is fixed by adding
<script src="webui.js"></script>
into the shown HTML. Seemingly, omitting adding webui.js
to the HTML causes events to occur much slower.
additional parameter for setting the timeout duration until close would be nice as well
I also think it takes too long for the backend to close, though this kind of feature would need to be added in https://github.com/webui-dev/webui as this library is just a wrapper
Thanks for the fast answer! :)
This is true, and is fixed by adding
<script src="webui.js"></script>
into the shown HTML.
Is this fix a known workaround and documented already (docs/readme)? Because if it's going to be a permanent issue I would highly suggest to put it somewhere obvious or include it in one of the tooltips. Actually I might do that if I can figure out how to change code on github, lmao.
I also think it takes too long for the backend to close, though this kind of feature would need to be added in https://github.com/webui-dev/webui as this library is just a wrapper
I do not write C and only know the very basics of it, has someone already opened an issue regarding this timer / do you plan on changing it in the near future or should I open one?
Regards
Thanks for the fast answer! :)
You're welcome <3
Is this fix a known workaround and documented already (docs/readme)? Because if it's going to be a permanent issue I would highly suggest to put it somewhere obvious or include it in one of the tooltips
I believe it is documented (at least it really, really, should be). I have also seen other maintainers of the WebUI project mention it in issues similar to #30.
Looking at the documentation at https://webui.me/docs/2.4/#/, this requirement is mentioned but it should be stressed more imo, as this causes a lot of confusion (I wonder if the other wrappers have been getting issues about this...).
Actually I might do that if I can figure out how to change code on github, lmao.
PRs are always welcome! :) lmk if you want to open one! Otherwise, I can add notices myself.
... has someone already opened an issue regarding this timer / do you plan on changing it in the near future or should I open one?
No one has opened one already; you can open one if you wish.
Only spawns one window
I just tested it in C, and it spawns all the windows.
additional parameter for setting the timeout
I guess this API already exist setTimeout(30);
, while detecting a connected window close event take ~100 millisecond, if the window is not connected (forgot to add webui.js
), then webui waits probably 30 seconds by default for the window to connect, which is controlled by setTimeout(30);
.
Is this fix a known workaround and documented already (docs/readme)?
You are right, the documentation does not show clearly the importance of webui.js
, we should update docs by putting more PR.
additional parameter for setting the timeout
I guess this API already exist
setTimeout(30);
Oh, you are right, it does lol. Skimmed through all the functions before and saw it as well, but thought it was meant for something else haha. Thanks for pointing it out to me 👍 :)
PRs are always welcome! :) lmk if you want to open one! Otherwise, I can add notices myself.
I'd like to try and do one, will hopefully remember to do it tomorrow!
Ignore the first branch mention thingy, I misunderstood something and deleted the branch after, lol. I'm not entirely sure whether the backend checks if other backends of its kind are active upon start or if that would even be possible. But, if not, then multiple browser crashes with setTimeout(0) should lead to multiple backends running at the same time (unless closed by other means). Also in the C code, I saw that providing a number greater 86400 to setTimeout() would also have the backend wait forever, is that correct?
The setTimeout()
is related with the how much time to wait for the browser to start and connect only, not the window close.
When a window close, wait()
should finish right away in all cases.
If you put webui.js
and you are connected properly, then when you close the window, your back-end wait()
should return right away, with or without setTimeout()
.
I saw that providing a number greater 86400 to setTimeout() would also have the backend wait forever
I guess yes, 86400 seconds is 24h, wish is too long, kind of wait forever by mistake.
then multiple browser crashes with setTimeout(0)
If it crash, then it's a bug that needs to be fixed, please provide more logs so we can know where is the issue.
The following problems happen on Windows11:
Only spawns one window. Upon closing the window, after a while the other window will show up. I don't know if I'm just too inexperienced/using the functions wrongly or if it's a bug.
Also, regarding the usual creation and closing of a window: The time it takes for the backend to close, after I close the browser window is a bit too long imo. I haven't looked yet, but I think an additional parameter for setting the timeout duration until close would be nice as well. E.g.: wait(2000) would check if the window is still there every 2 secs.