GoogleChromeLabs / text-editor

A text editor build on the Native File System APIs
https://googlechromelabs.github.io/text-editor/
Apache License 2.0
507 stars 118 forks source link

How did you get it not to ask for permission on already granted folder? #36

Open delebash opened 3 years ago

delebash commented 3 years ago

I have read your article on this. Thanks for that! I have tried to follow the sample but when a user selects a folder that they have already been granted access but it still asks for permission.

Simple code example -- as in your example get and set are shorthand for getting and setting values to indexDb using idb-keyval

asyn function (){
 let dirHandle = await get("directory");
 dirHandle = await window.showDirectoryPicker();
  await set("directory", dirHandle);
}

Expected results: Every time a user picks a folder it should not ask for permission on subsequent calls even after page refresh since I am storing and retrieving dirHande from indexDb which should give me permissions already saved. I doing a page refresh for testing immediately so should not have to reverify permissions. Although I will add that check according to your article.

Thanks. Dan