GoogleChromeLabs / browser-fs-access

File System Access API with legacy fallback in the browser
https://googlechromelabs.github.io/browser-fs-access/demo/
Apache License 2.0
1.37k stars 82 forks source link

demo is not work in edge #133

Closed TinsFox closed 1 year ago

TinsFox commented 1 year ago

I try the example in the edge, but it nor work. here is my edge info:

image

And then I code a demo like this, the console say it's supported

code ```tsx import { directoryOpen, supported } from 'browser-fs-access'; const Editor = () => { if (supported) { console.log('Using the File System Access API.'); } else { console.log('Using the fallback implementation.'); } const appendImage = (blob) => { const img = document.createElement('img'); img.src = URL.createObjectURL(blob); document.body.append(img); img.onload = img.onerror = () => URL.revokeObjectURL(img.src); }; const listDirectory = (blobs) => { let fileStructure = ''; blobs .sort((a, b) => a.webkitRelativePath.localeCompare(b)) .forEach((blob) => { // The File System Access API currently reports the `webkitRelativePath` // as empty string `''`. fileStructure += `${blob.webkitRelativePath}\n`; }); // pre.textContent += fileStructure; blobs .filter((blob) => { return blob.type.startsWith('image/'); }) .forEach((blob) => { appendImage(blob); }); }; const onClick = async () => { try { const blobs = await directoryOpen(); console.log('blobs', blobs); listDirectory(blobs); } catch (err) { console.log('err', err); if (err.name !== 'AbortError') { return console.error(err); } // console.log(ABORT_MESSAGE); } }; return ( <> ); }; export default Editor; ```
image
tomayac commented 1 year ago

It looks like your onClick() function is never called. Are you sure it's hooked up correctly?

TinsFox commented 1 year ago

It looks like your onClick() function is never called. Are you sure it's hooked up correctly?

I trigger through the click event of the button. Confusingly, when I checked again just now it was working fine again! But in the afternoon, he really can't wake up the window for selecting file folders.

tomayac commented 1 year ago

Seems to be fine then. Thanks!