- Notifications
You must be signed in to change notification settings - Fork 159
Add Web Workers API (SharedWorker, WorkerScopes, ServiceWorker) (fixes #186) #187
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
Conversation
| Disclaimer: Untested yet, I am on it |
| 👍 I'll take a proper look tomorrow. It would be good to pull |
| Okay, gonna pick up #180 (comment) and move them to the experimental package. Would you be fine with merging all worker related api into a |
| Yes, I think that'll work. From a user perspective that won't have much impact. |
| Thanks :) |
|
in I'll also keep WebWorkers and ServiceWorker separated (different W3C standards) since WebWorkers should already be pretty stable but ServiceWorker probably still will get some changes. (There is one weird dependency from WebWorkers to ServiceWorkers left, MDN declares |
fbeedd8 to e3a9647 Compare | Actually, I'd put it in a subpackage specifically for workers- that way people can import just the features that they want without accidentally pulling in all experimental apis (and getting tripped up believing they're accessing a standard method in an unrelated api). Rather than deleting the currently exposed types from the |
e3a9647 to 4c04e27 Compare | Yeah thats what i thought too - so we'd also need a org.scalajs.dom.raw package-object that has |
| Yep, This is what happens when things go in the wrong place. Sorry about that :/ |
| One could argue that the types in the raw-package are non-public anyway and one should only rely on types on |
| You could. Unfortunately Intellij sucks classes from their package of definition when using autocomplete/import, so people are probably already doomed :) (And actually, I think there are some classes that are only exposed in |
| Oh, definitely think you should use something like |
| Thats what I ment - if they only existed in dom.raw - they never have been public and we could move them freely - but i know what you mean ;) I'd prefer the original spec name (webworkers, serviceworkers -maybe to longish?) - think it is a good idea anyway to roughly split our packages by w3c api - or feature - just tried to stick with the existing convention. |
| I definitely agree with classification by specification. As for 'convention', apart from a few apis, it has generally been "chuck it in I notice actually that Channel Messaging is flagged here as 'very compatible'. But Service Workers are (extremely) experimental. For now we can probably keep them in |
| (renamed PR Channel Messaging API to Web Workers API - but that one looks stable too - but not fully supported by IE) |
8b6eb8b to d194db0 Compare | Okay - I came up with the following solution:
Caveats:
Sorry for this back and forth noise (and those tons of builds) |
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.
Drop @return. (the same thing happens elsewhere)
| That's all. |
dd3885c to c119d74 Compare | @sjrd cheers. all done. I am off writing a scalariform config. or trying to push this into the idea formatter. that was a bit cruel :) (no doubt, reviewing for code style must be no fun either) |
| stoopid travis lost network, so that test failed. :/ |
| LGTM |
…erApi to experimental (fixes scala-js#186)
c119d74 to 9ffb2eb Compare | @mseddon squashed! |
| Thanks! @sjrd okay to merge? |
| LGTM |
Fix #186: Add Web Workers API (SharedWorker, WorkerScopes, ServiceWorker)
This PR adds interfaces for the following Web Workers API interfaces (all in the experimental package for now - even they are not really tagged as experimental in MDN):
The following interfaces for ServiceWorkers are added
The idea is that a user can create a
serviceWorker.jswith scala.js (with a wrapper that directly calls the main method) like this (note that the message event comes from ServiceWorker):