-
Notifications
You must be signed in to change notification settings - Fork 479
Allow omitting name while creating dynamic workers #5574
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
base: main
Are you sure you want to change the base?
Conversation
|
The generated output of |
2568333 to
df2bb8e
Compare
| assert.strictEqual(loadCount, 5); | ||
| // Test that null/undefined name parameter creates unique isolates each time | ||
| // Each call should generate a unique name internally. | ||
| let noName1 = env.loader.get(null, loadCodeCallback).getEntrypoint(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore this, but what about allowing env.loader.get(loadCodeCallback).getEntrypoint()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original version of this PR reversed the ordering of the params to make the param optional, but that was a breaking change.
But we could, perhaps, create an "overloaded" interface, which accepts either (id, func) or (func). But overloads are kind of awkward.
And actually, if you think about it, when the ID is null, then there's no need for a callback. The callback will always be called, so instead we should just let you pass in the worker definition instead of a callback.
So maybe what we really want is a new method like: load(code)
Which is logically equivalent to: get(null, () => code)
Either way I think passing null to get() should be supported. But probably we want to add this new load() method as well.
|
Should be fixed now |
3e034c3 to
72b9bbf
Compare
No description provided.