Skip to content
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

Implement support for a blob url instead of a path #23

Open
stevenvachon opened this issue Jun 9, 2017 · 9 comments
Open

Implement support for a blob url instead of a path #23

stevenvachon opened this issue Jun 9, 2017 · 9 comments

Comments

@stevenvachon
Copy link

stevenvachon commented Jun 9, 2017

similar to function-thread.

If you use the vm module, it already takes a string. As for Worker, you could use a data-url.

@josdejong
Copy link
Owner

Thanks for the suggestion.

I guess you mean to send a script containing functions instead of passing the url of a script. A single function can already be executed in a worker easily without even having to stringify it (see docs).

@stevenvachon
Copy link
Author

Thanks!

@josdejong
Copy link
Owner

Why do you close the issue? Do you only need passing a single function?

@stevenvachon
Copy link
Author

The exec() method provides the functionality that I was after. I'd just missed it when I skimmed through the readme.

@josdejong
Copy link
Owner

ah ok perfect! let's keep it closed then.

If anyone is interested in passing a complete script as string we can reopen this issue.

@stevenvachon
Copy link
Author

stevenvachon commented Jun 11, 2017

Actually, I think I got confused. This is what I'd originally requested:

workerpool.pool("data:application/javascript;utf-8,(function(){…})()")

so that we don't need to have a separate "workerpool.js" file

@stevenvachon stevenvachon reopened this Jun 11, 2017
@josdejong
Copy link
Owner

Yes exactly, so you can bundle your worker file in the main file and load it as a string. That can be useful I think.

@josdejong
Copy link
Owner

See also #46 (duplicate)

@josdejong josdejong changed the title Take a function string instead of a path/URL Implement support for a blob url instead of a path Aug 21, 2019
@josdejong
Copy link
Owner

I've created an example on creating an embedded worker using a data URL, that works out of the box already:

https://github.com/josdejong/workerpool/tree/master/examples/embeddedWorker

Support for data URL's in node.js requires work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants