Skip to content

Editorial review: Document FileSystemObserver#38270

Merged
wbamberg merged 17 commits into
mdn:mainfrom
chrisdavidmills:filesystemobserver
Feb 27, 2025
Merged

Editorial review: Document FileSystemObserver#38270
wbamberg merged 17 commits into
mdn:mainfrom
chrisdavidmills:filesystemobserver

Conversation

@chrisdavidmills

@chrisdavidmills chrisdavidmills commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

Description

Chrome 133 supports the FileSystemObserver interface, which allows you to observe changes to the underlying file system via a standard observer mechanism.

This PR adds documentation for the new functionality, which mainly consists of new reference pages for the new interface.

Note that the feature is currently non-standard (see whatwg/fs#165), although it should be added to the spec soon. I have currently documented it as such.

Motivation

Additional details

See the relevant ChromeStatus entry for data: https://chromestatus.com/feature/4622243656630272

Relevant blog post: https://developer.chrome.com/blog/file-system-observer#start_observing_a_file_or_directory

Related issues and pull requests

Related BCD: mdn/browser-compat-data#25986

@chrisdavidmills chrisdavidmills requested review from a team as code owners February 21, 2025 14:48
@chrisdavidmills chrisdavidmills requested review from pepelsbey and sideshowbarker and removed request for a team February 21, 2025 14:48
@github-actions github-actions Bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Feb 21, 2025
@github-actions

github-actions Bot commented Feb 21, 2025

Copy link
Copy Markdown
Contributor
Preview URLs (6 pages)
Flaws (6)

Note! 5 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/File_System_API
Title: File System API
Flaw count: 6

  • broken_links:
    • /en-US/docs/Web/API/window/showOpenFilePicker is ill cased
    • /en-US/docs/Web/API/window/showDirectoryPicker is ill cased
    • /en-US/docs/Web/API/window/postMessage is ill cased
  • macros:
    • Macro produces link /en-US/docs/Web/API/window/showOpenFilePicker which is a redirect
    • Macro produces link /en-US/docs/Web/API/window/showDirectoryPicker which is a redirect
    • Macro produces link /en-US/docs/Web/API/window/postMessage which is a redirect
External URLs (14)

URL: /en-US/docs/Web/API/FileSystemChangeRecord
Title: FileSystemChangeRecord


URL: /en-US/docs/Web/API/FileSystemObserver
Title: FileSystemObserver


URL: /en-US/docs/Web/API/FileSystemObserver/disconnect
Title: FileSystemObserver: disconnect() method


URL: /en-US/docs/Web/API/FileSystemObserver/observe
Title: FileSystemObserver: observe() method


URL: /en-US/docs/Web/API/FileSystemObserver/FileSystemObserver
Title: FileSystemObserver: FileSystemObserver() constructor

(comment last updated: 2025-02-27 19:01:14)

@chrisdavidmills chrisdavidmills changed the title Document FileSystemObserver Technical review: Document FileSystemObserver Feb 21, 2025

@tomayac tomayac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks great. Left a bunch of suggestions.

Comment thread files/en-us/web/api/filesystemobserver/filesystemobserver/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/filesystemobserver/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/filesystemobserver/index.md
Comment thread files/en-us/web/api/filesystemobserver/index.md Outdated
Comment thread files/en-us/web/api/file_system_api/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/observe/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/observe/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/observe/index.md Outdated
chrisdavidmills and others added 4 commits February 22, 2025 17:38
…x.md

Co-authored-by: Thomas Steiner <tomac@google.com>
Co-authored-by: Thomas Steiner <tomac@google.com>
Co-authored-by: Thomas Steiner <tomac@google.com>
@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

@tomayac thanks for the review! I think I've answered everything. Let me know if you feel this needs anything else, or give me an LGTM if you are happy with it.

@chrisdavidmills chrisdavidmills changed the title Technical review: Document FileSystemObserver Editorial review: Document FileSystemObserver Feb 24, 2025
@wbamberg wbamberg requested review from wbamberg and removed request for tomayac February 24, 2025 16:39
Comment thread files/en-us/web/api/file_system_api/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/disconnect/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/filesystemobserver/index.md Outdated
Comment on lines +30 to +32
#### `FileSystemChangeRecord` structure

`FileSystemChangeRecord` objects have the following structure:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think there are really two ways of dealing with dictionaries:

  1. document them inline as anonymous objects (so under the records bullet above say something like "an array of objects contain details of all the observed changes. Each object has the following properties:"
  2. document them in separate pages, like we do for example with https://developer.mozilla.org/en-US/docs/Web/API/RequestInit.

Because this is quite a complex object it might be worth going with (2) here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK, I've given it a go. My next commit now contains a new FileSystemChangeRecord page, which is included in the sidebar and linked to from the appropriate places.

Comment thread files/en-us/web/api/filesystemobserver/filesystemobserver/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/observe/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/observe/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/observe/index.md Outdated
Comment thread files/en-us/web/api/filesystemobserver/observe/index.md Outdated
@tomayac

tomayac commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

Just confirming that https://glitch.com/edit/#!/file-system-observer?path=.prettierrc%3A1%3A0 is by me, @tomayac. It's the demo embedded in the article on chrome.dev.

Screenshot 2025-02-27 at 11 06 13

@Elchi3

Elchi3 commented Feb 27, 2025

Copy link
Copy Markdown
Member

What's the license of your code, @tomayac? If we want to publish your code (at a later stage) in https://github.com/mdn/dom-examples (CCO) would that be compatible?

@tomayac

tomayac commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

What's the license of your code, @tomayac? If we want to publish your code (at a later stage) in https://github.com/mdn/dom-examples (CCO) would that be compatible?

All our code samples are Apache-2.0 licensed. You can publish the sample without any worries.

@chrisdavidmills

Copy link
Copy Markdown
Contributor Author

What's the license of your code, @tomayac? If we want to publish your code (at a later stage) in https://github.com/mdn/dom-examples (CCO) would that be compatible?

All our code samples are Apache-2.0 licensed. You can publish the sample without any worries.

Thanks @tomayac; see #38270 (comment).

@wbamberg wbamberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just a couple of suggestions in the new FileSystemChangeRecord page.

Comment thread files/en-us/web/api/filesystemchangerecord/index.md Outdated
Comment thread files/en-us/web/api/filesystemchangerecord/index.md Outdated

@wbamberg wbamberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍 thank you Chris!

@wbamberg wbamberg merged commit 328a784 into mdn:main Feb 27, 2025

{{APIRef("File System API")}}

The **`FileSystemChangeRecord`** dictionary of the {{domxref("File System API", "File System API", "", "nocode")}} contains details of a single change observed by a {{domxref("FileSystemObserver")}}.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@wbamberg @chrisdavidmills Any reason for documenting this dictionary in its own page rather than inlining it, as per our typical policy?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's discussed here: #38270 (comment). Arguably, because it's a large and complex object, it's easier to read the docs when it is a separate page than when it is inline.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't feel very strongly though. I don't think this is a clear "use a dictionary" case - in particular, it is only used in that one place. But I could see the constructor page getting pretty unwieldy with all those indented lists to keep straight.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK that sounds reasonable. Just making sure we are not making more undesirable stuff that we have to clean up laer.

cssinate pushed a commit to cssinate/content that referenced this pull request Apr 11, 2025
* Document FileSystemObserver

* Update files/en-us/web/api/filesystemobserver/filesystemobserver/index.md

Co-authored-by: Thomas Steiner <tomac@google.com>

* Update files/en-us/web/api/filesystemobserver/index.md

Co-authored-by: Thomas Steiner <tomac@google.com>

* Update files/en-us/web/api/file_system_api/index.md

Co-authored-by: Thomas Steiner <tomac@google.com>

* Fixes for tomayac review comments

* Update files/en-us/web/api/file_system_api/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update files/en-us/web/api/filesystemobserver/disconnect/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update files/en-us/web/api/filesystemobserver/filesystemobserver/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update files/en-us/web/api/filesystemobserver/filesystemobserver/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update files/en-us/web/api/filesystemobserver/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update files/en-us/web/api/filesystemobserver/observe/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update files/en-us/web/api/filesystemobserver/observe/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Add FileSystemChangeRecord page, other fixes from wbamberg review

* Update files/en-us/web/api/filesystemchangerecord/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update files/en-us/web/api/filesystemchangerecord/index.md

Co-authored-by: wbamberg <will@bootbonnet.ca>

* Update FileSystemChangeRecord description

---------

Co-authored-by: Thomas Steiner <tomac@google.com>
Co-authored-by: wbamberg <will@bootbonnet.ca>
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants