Skip to content
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

Namespace for methods currently added to Window / WindowOrWorkerGlobalScope? #210

Closed
pwnall opened this issue Jul 26, 2020 · 6 comments
Closed
Assignees
Milestone

Comments

@pwnall
Copy link
Collaborator

pwnall commented Jul 26, 2020

The spec currently adds three methods to Window (showOpenFilePicker, showSaveFilePicker, showDirectoryPicker) and one method to WindowOrWorkerGlobalScope (getOriginPrivateDirectory).

By contrast, other modern storage APIs have a single entry point.

While I'll admit this is not a "regular" storage API (it doesn't only expose access to origin-scoped isolated storage, and its semantics depend on the underlying operating system and file system) I think it would still be nice if we hanged all methods off of a single entry point. WDYT?

@mkruisselbrink
Copy link
Contributor

I don't feel strongly either way. It does seem like getOriginPrivateDirectory is a sufficiently different API from the picker ones that I'm not convinced it makes sense to group those together. Also in workers that is currently the only exposed method. It seems a bit weird to have a namespace for a single method.

Also note that tag guidance seems to argue against the current form of the indexedDB/caches singletons. These days this should at least be a a webidl namespace instead (https://w3ctag.github.io/design-principles/#example-09c8f087). Although I'm not sure what modern APIs have actually taken that advice...

@mkruisselbrink
Copy link
Contributor

So yeah, I guess the option then would be wrap everything in a namespace FileSystem, or leave as is. Perhaps the namespace one would indeed be nicer...

@mkruisselbrink
Copy link
Contributor

although blink bindings don't currently support webidl namespaces; but they can still sort of be simulated by classes with no constructor and only static methods... Which wouldn't be exactly what webidl namespaces are like, but hopefully close enough that we could later change without breaking any code...

@inexorabletash
Copy link
Member

Can we call this out on the TAG design review request?

@mkruisselbrink
Copy link
Contributor

Yes, it's on my list, will do asap.

@mkruisselbrink
Copy link
Contributor

After talking to some people, I think I'm leaning towards leaving the various file picker methods alone as free-standing methods on the global, but moving (and renaming) getOriginPrivateDirectory to StorageManager.
There seems little chance for conflict with these names, and as such namespacing doesn't seem to buy us much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants