scala-js/scala-js-dom

We're leaking experimental APIs

mseddon opened this issue · 14 comments

It appears the WebAudio api accidentally introduced a MediaStream trait (stubbed) into scala.js.dom.raw here. This type is also forwarded in dom.

As you can see though, it's not compatible enough to meet the criteria of being outside of experimental. But sadly, we've released it in 0.8.1 and 0.8.2.

There may be others, and I will investigate.

@sjrd @lihaoyi I wonder since the next release will be 0.9.0 if we do some slightly breaking reorganization to fix up anything that slipped out? Hopefully it won't impact too many people.

#179 fleshes out the MediaStream class (because it's needed for WebRTC), but I've been afraid to move it into experimental without checking with you guys that this breaking change is acceptable.

sjrd commented

Sure, we can break things.

You can also add a deprecated forwarder in the original location.

Ah, that's good- I wasn't sure if it was possible to annotate type. That makes this kind of reorg much less worrying.

ServiceWorker, ServiceWorkerRegistration, ServiceWorkerContainer, all want to live in experimental.serviceworker. Fixed in #187

Promise is sort of annoying- http://caniuse.com/#feat=promises since they're not present in IE11. They are in Edge, but that unfortunately doesn't mean anything to windows 7 and windows 8 users.

sjrd commented

Promise needs to go to core anyway, because it's specified in ES6 itself.

EventSource is not supported in IE or Edge.

That's everything I found in lib.scala. It appears WebAudio.scala in general should live in experimental, because it is not supported under IE.

IndexDB is an interesting one. IE and Edge don't support some operations, and Safari's implementation is just broken. Technically it's "present" though.

Given that getBoundingClientRect happens to be broken under chrome android (it doesn't take into account viewport scroll position), I think IndexDB can probably stay.

@sjrd @mseddon Is this still an issue? If it is, I'd be happy to go clean up what is left.

@kapunga Thanks! The obvious one remaining I think is the WebAudio api, but if EventSource is not heavily referenced it should also be fairly trivial to migrate. I think we might as well hold off on Promise, since it will find it's way into the core Scala.js library in a future release anyway,which doesn't really distinguish 'experimental'. We might stick a warning and reference to a recommended Promise polyfill in the scala-js-dom documentation as a stop-gap measure.

Okay, I'm starting work on this. From poking around the documentation, it appears that it's not the WebAudio API that is experimental, but the MediaStream API (as described here: https://www.w3.org/TR/mediacapture-streams/), correct?
The AudioNode member of the WebAudio API appears to be widely adopted: http://caniuse.com/#search=AudioNode
Whereas MediaStream does not:
http://caniuse.com/#search=MediaStream

@mseddon Actually, nevermind, I think the MediaStream stuff is all covered in PR #203? IT looks like that's it for this issue, so I guess when it's fix, it should be good.

@kapunga the reasoning behind WebAudio in general being experimental for now is that it is not supported on IE11. Currently IE11 has considerable market share (in that, it would be unwise to build a site that does not target it today), and the purpose of the experimental package is to flag libraries that fall into these categories. I would definitely say that at least until Edge absorbs these users, we don't want to trick people into thinking it is 'common'.

That said- it might be better to wait until #203 is merged before moving this, since it would almost certainly tempt conflicts in the short term :)

Another one to tuck under the rug I think 😅