-
Notifications
You must be signed in to change notification settings - Fork 143
[worklets] (bikeshedding time!) import() name is potentially confusing... #374
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
Comments
Is there a dedicated issue for the |
Filed: #376 for designing that. |
Yeah, I feel Other idea: |
I like spawn, short and sweet. cc @domenic |
I don't have strong opinions. import() isn't that bad IMO. spawn() seems nice if it fits with the model. importInto() is another idea. |
cc @surma halp. |
I'm ok with |
Just in case, my previous comment is from implementer's pov. Probably web developers have different impressions, and I'm also ok with import() if they aren't confused by it :) |
(Before I start: I could settle for Okay, here goes: This has been bugging me for a while but I never said anything because I thought this was a done deal, but I guess now is my chance 😅 I always found it weird that theres some sort of magic global for each worklet that loads code. That code then proceeds to create an instance of something that – from there on in – would usually be referred to as “my XYZ Worklet”. Taking some inspiration from workers, I’d find something like |
What would the type look like, here? |
Module scripts don't use a mime type, so this probably shouldn't. I think that discussion is happening in #376. |
A constructor like @surma suggests makes sense if having an instance is useful. In terms of a method, does it need to be more complicated than: await CSS.paintWorklet.add('paint.js'); |
I think the reason there's no constructor is because it doesn't make sense to have more than one instance, so you'd need to keep global state to prevent multiple instances at which point you might as well just have it there. And the main reason to favor something like |
The CSS Working Group just discussed Worklets, and agreed to the following resolutions:
The full IRC log of that discussion
|
@nhiroki FYI :) |
Chromium bug: https://crbug.com/713018 @bfgeek :) |
Oops. I really need to find a way to get notified this sort of change. |
So the import function has been noted as potentially confusing.
Other names which have been discussed at some point are:
loadModule
(@adamk)distributeScript
(@annevk)For additional context the other way to invoke scripts will be via the script tag most likely, e.g.
Which is the same as
From #373 originally.
The text was updated successfully, but these errors were encountered: