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
Extend useWebWorkerFn to also accept an array of local dependencies #2005
Labels
enhancement
New feature or request
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hello, I went to the same problem. Is there any solution now? Thanks. |
Bump |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clear and concise description of the problem
useWebWorkerFn
provides an option calleddependencies
in which you can give an array of strings that are paths to javascript files that the web worker will then import so that it can use any variables and functions that are globally defined in those javascript files.However, often times you already have some functions in your local scope and it would be much more convenient to be able to just provide an array of references to those functions in an option called
localDependencies
.So it might look something like this:
Suggested solution
According to the docs
useWebWorkerFn
is a port from Alessio Koci's useWorker, which according to its docs allows the developer to provide an array of references to local functions so that they can be used inside the worker.This is different from the
externalDependencies
option (which vueuse has renamed todependencies
) that already exists, because then you really need to create a separate file for that function and then provide it using the path to that file. ThelocalDependencies
option is just way more convenient in many cases.And from what I understand, Alessio Koci also didn't create this feature himself, but that it ultimately comes from Arjun Barrett's isoworker.
So basically my request is, can you please copy that feature into
useWebWorkerFn
? And maybe, if you're gonna add an option calledlocalDependencies
, then I would deprecate thedependencies
and rename it toexternalDependencies
.Alternative
I can't think of an alternative other than just keeping everything as it is now... Like it isn't impossible to do certain things without this
localDependencies
option, it's just less convenient.Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: