Skip to content

Conversation

@mingyc
Copy link
Contributor

@mingyc mingyc commented Apr 9, 2025

@mingyc
Copy link
Contributor Author

mingyc commented Apr 16, 2025

@domenic Could you please provide some feedback on the API shape?

FileSystemObserverObserverOptions options = {});
// Unsubscribes to changes to a FileSystemHandle. Returns a Promise that
// resolves when the unsubscription completes.
Promise<void> unsubscribe(FileSystemHandle handle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different from https://developer.mozilla.org/en-US/docs/Web/API/PushManager which puts the unsubscribe() on the subscription object, but the same as https://wicg.github.io/cookie-store/#CookieStoreManager .

I would be interested to know more about why these two APIs made different choices, and how that should guide our choices.

Copy link
Contributor Author

@mingyc mingyc Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some arguments here

  • Adding unsubscribe() to FileSystemHandle seems to suggest that a handle can be subscribed anywhere? But it actually only works in certain context (SW).
  • To align with FileSystemObserver.unobserve(handle). As stated in the background sction, FileSysttemObserver inspires this proposal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, subscribe() doesn't return anything in our case. That makes sense.

@mingyc
Copy link
Contributor Author

mingyc commented Apr 16, 2025

Thanks for your speedy feedback! I've addressed most of comments. PTAL.

FileSystemObserverObserverOptions options = {});
// Unsubscribes to changes to a FileSystemHandle. Returns a Promise that
// resolves when the unsubscription completes.
Promise<void> unsubscribe(FileSystemHandle handle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, subscribe() doesn't return anything in our case. That makes sense.

Copy link
Contributor

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@rektide
Copy link

rektide commented Apr 20, 2025

Just curious, has this been discussed elsewhere, or is this PR the first time this is coming?

To create some links, I will mention that this work seems to extend whatwg/fs#165. That PR, FileSystemObserver, should be a viable strategy towards accomplishing #72 and whatwg/fs#124, requests for observation/watching/file-notification.

@mingyc
Copy link
Contributor Author

mingyc commented Apr 22, 2025

Hi @rektide, this PR does evolve from FileSystemObserver, which has been launched in Chromium. This new interface is trying to support such capability in service workers. It was only discussed internally in Chromium but not here. We are publishing this to look for more feedback before going into implementation.

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

Successfully merging this pull request may close these issues.

4 participants