You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to do something rather complicated, where I send a message from the love.worker.js to the main thread of the browser, which then causes an event listener to run some javascript code on the main thread. However, I'm having trouble identifying if there is a global variable for the worker that runs the lua code. I essentially just need to add an event listener, but that require me to know the variable containing the worker... and this code is complicated as all get out haha. Can you perhaps point me to the variable containing the worker?
Thanks,
-Michael.
The text was updated successfully, but these errors were encountered:
love.worker.js enables love.thread in love.js. It is not designed to be accessed directly from within the love environment. If you want to create a worker and pass commands to it in the love environment you would do so the same as you would for a native game (so long as you are using the release target, not the compat target). There is a simple example on the wiki love.thread. Like the main thread, this thread would have no access to the javascript environment.
If you want to make a callback into the javascript environment, love.js-api-player provides an async interop. There is an example setup in #89.
Hiya,
I'm trying to do something rather complicated, where I send a message from the love.worker.js to the main thread of the browser, which then causes an event listener to run some javascript code on the main thread. However, I'm having trouble identifying if there is a global variable for the worker that runs the lua code. I essentially just need to add an event listener, but that require me to know the variable containing the worker... and this code is complicated as all get out haha. Can you perhaps point me to the variable containing the worker?
Thanks,
-Michael.
The text was updated successfully, but these errors were encountered: