Function
getHandleRecord
(root: FileSystemFileHandle, observer: FileSystemObserverInstance)
Source from the content-addressed store, hash-verified
| 9 | }; |
| 10 | |
| 11 | const getHandleRecord = async (root: FileSystemFileHandle, observer: FileSystemObserverInstance) => { |
| 12 | for (const [fileHandle, ftInfo, fileObserver] of handleRecords) { |
| 13 | if (fileObserver !== observer) continue; |
| 14 | try { |
| 15 | const isSame = await root.isSameEntry(fileHandle); |
| 16 | if (isSame) { |
| 17 | return ftInfo; |
| 18 | } |
| 19 | } catch (e) { |
| 20 | // 捕捉非预期错误 |
| 21 | console.warn(e); |
| 22 | } |
| 23 | } |
| 24 | return null; |
| 25 | }; |
| 26 | |
| 27 | const callback = async (records: FileSystemChangeRecord[], observer: FileSystemObserverInstance) => { |
| 28 | try { |
Tested by
no test coverage detected