purescript-web/purescript-web-dom

URL createObjectURL?

justinwoo opened this issue · 5 comments

We used to have this in here, but maybe I just haven't found it in the right place.

Wouldn't it belong in -web-file?

It's under URL and doesn't only work with file objects afaik

garyb commented

Gabe is right actually, it's part of the File API: https://w3c.github.io/FileAPI/#dfn-createObjectURL

I think it makes sense to move URL (and maybe the whole of the History API) from -web-html to -web-dom and change the signatures of Web.DOM.Document.url and Web.DOM.Node.baseURI to return Effect URL instead of Effect String.

Thoughts?

garyb commented

The type situation with URL is a bit of a mess, but no, I don't think we should do that. Ideally we'd use the "proper" URI type, but that's too opinionated for the -web stuff probably. Plus a bit annoying to use without unsafe construction (...a type-level parser would be nice one day 😉).

The URL that createObjectURL belongs to is just a namespace object, it's not a type that can be constructed. I think adding the two functions it has under Web.File.URL will help avoid confusion with it relating to a URL type that is used elsewhere.