MCPcopy Create free account
hub / github.com/GoogleChrome/samples / apiVersionCheck

Function apiVersionCheck

sqlite-wasm-cos/sqlite3.mjs:20816–20829  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20814 has a "fully-sync" SAH impl, else a rejected Promise.
20815 */
20816 const apiVersionCheck = async ()=>{
20817 const dh = await navigator.storage.getDirectory();
20818 const fn = '.opfs-sahpool-sync-check-'+getRandomName();
20819 const fh = await dh.getFileHandle(fn, { create: true });
20820 const ah = await fh.createSyncAccessHandle();
20821 const close = ah.close();
20822 await close;
20823 await dh.removeEntry(fn);
20824 if(close?.then){
20825 toss("The local OPFS API is too old for opfs-sahpool:",
20826 "it has an async FileSystemSyncAccessHandle.close() method.");
20827 }
20828 return true;
20829 };
20830
20831 /**
20832 installOpfsSAHPoolVfs() asynchronously initializes the OPFS

Callers 1

sqlite3InitModuleFunction · 0.70

Calls 3

getRandomNameFunction · 0.70
tossFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected