Skip to content

Commit

Permalink
Update FileSystemObserver.md
Browse files Browse the repository at this point in the history
Explain the interactions with Back/forward Cache
  • Loading branch information
dslee414 authored Jun 28, 2024
1 parent d6b2388 commit b2efb3f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions proposals/FileSystemObserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ Likewise, changes which occur before an observer is created should not be report

A `FileSystemObserver` is not [serializable](https://html.spec.whatwg.org/multipage/structured-data.html#serializable) and therefore cannot be persisted across browsing sessions. Websites which wish to watch the same files on each session may store serializable `FileSystemHandle` and `FileSystemObserverObserveOptions` objects in IndexedDB, then create a `FileSystemObserver` and configure it from these objects on page reload.

### Interactions with Back/forward Cache

If changes occurred while the page was not fully active, and the page becomes active again (i.e. back/forward cache), then user agents may use the `"unknown"` `FileSystemChangeType` to indicate that _changes_ have occurred. Specific types and ordering of changes should not be exposed but indicating that some changes have occurred could be useful to the website to perform any special handling.

### Signaling Changes Made via a `FileSystemSyncAccessHandle`

It is assumed that a user agent’s implementation of the `FileSystemObserver` interface will involve coordinating with a centralized browser process. However, unlike most web storage APIs, reading and writing files with a `FileSystemSyncAccessHandle` is commonly implemented largely without coordinating with a centralized browser process. This is critical to the exceptional performance characteristics of this interface. `write()` or `truncate()` operations on a `FileSystemSyncAccessHandle` should trigger a file system change record, but requiring round-trip IPC to complete before synchronously returning would be detrimental to performance.
Expand Down Expand Up @@ -374,8 +378,6 @@ await observer.observe(directoryHandle, { recursive: true });
// corresponding to `directoryHandle`, then `touch file.txt`)
```

User agents may also use the `"unknown"` `FileSystemChangeType` to indicate that a change has occurred but the type of change is unknown or is not to be specified to the site. This could mean that the change type does not belong to any other values defined in `FileSystemChangeType` due to cross-platform differences, or a change has occurred while the site was not fully active (i.e. site in back/forward cache becomes fully active again).

#### When to Signal Local File System Writes

Writing to a file on the local file system generally looks like the following:
Expand Down

0 comments on commit b2efb3f

Please sign in to comment.