deno-windowing / dwm

Deno Window Manager: Cross-platform window creation and management
https://deno.land/x/dwm
Apache License 2.0
138 stars 10 forks source link

Can't Fetch #14

Closed nhrones closed 1 year ago

nhrones commented 1 year ago

Is there any reason a fetch call does not work in a DWN app? When I try to fetch from a localhost server, the promise neither resolves nor rejects? It seems to be swallowed.

DjDeveloperr commented 1 year ago

Any async tasks must be run and awaited under the mainloop function's callback.

If you want to make it usable anywhere at the cost of performance, set loop argument in mainloop function to false.

These limitations are there because UI events take over the Deno Event Loop by default as they are blocking in nature. Another option is for you to run some of your code in a worker and only handle the UI stuff in main thread. However don't update UI directly from a different thread.

nhrones commented 1 year ago

Thanks for the quick reply. I understand now. I'll close this as asked and answered.

nhrones commented 1 year ago

Working now! Posting debug messages to a remote logging service that streams to a local debug web page. Think detached GUI-console.log! Helping me to debug > TextArea-Scrollbar dev. Thanks for all you do!