URL is not exposed as a global object
Closed this issue · 3 comments
Calling URL.createObjectURL()
is not possible as URL
is only a trait. It should be exposed as a global object for easy access to its static methods.
Workaround is to implement the object in your own code as
@js.native
object URL extends dom.URL
The fix (ac070db) removed the trait, which removed access to the constructor, which seems to be a regression. Instead of replacing the URL trait with the object definition, the trait should be brought back and maybe also some of URL's properties should be exposed.
See https://url.spec.whatwg.org/#api and
https://developer.mozilla.org/en-US/docs/Web/API/URL/URL.
The trait did not give access to the constructor. The non-"static" (and experimental) part of URL
has never been there. So the fix you mention did not remove anything that was there before.
Feel free to open a separate issue (and PR) for the missing non-static parts.
Ah, right. Just saw I had a class implementing the trait. Will submit a PR