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

Remove Listener Issue #142

Closed renato-mauro closed 1 year ago

renato-mauro commented 1 year ago

Hello! Thanks for your work. Helped me a lot. There is a small issue when you are removing the event listener for window focus. As it was registered with useCapture = true, it should be unregistered using also useCapture = true argument.

https://github.com/GoogleChromeLabs/browser-fs-access/blame/5d8a551af106121d010c1c50ca4a15d3cb0b189d/src/legacy/file-open.mjs#LL32

tomayac commented 1 year ago

Thank you! Just released v0.34.0 that includes this fix.

hshafie commented 1 year ago

I'm sorry but I don't understand this change. In v0.34.0, legacy/file-open.mjs, I see:

    input.addEventListener('click', () => {
      window.addEventListener('focus', cancelDetector);
    });

No useCapture=true third argument there (and useCapture defaults to false).

tomayac commented 1 year ago

You're right. I didn't realize that the link went to outdated code. Sorry.

hshafie commented 1 year ago

No problem. Thank you for the quick response and of course, for your very useful library.