@@ -24,7 +24,7 @@ const supportOPFS = await isOpfsSupported()
2424console . log ( 'support module worker:' , supportModuleWorker )
2525console . log ( 'support IDBBatchAtomicVFS:' , supportIDB )
2626console . log ( 'support OPFSCoopSyncVFS:' , supportOPFS )
27- document . querySelector ( '.main' ) ?. addEventListener ( 'click' , async ( ) => {
27+ document . querySelector ( '.main-idb ' ) ?. addEventListener ( 'click' , async ( ) => {
2828 if ( ! db ) {
2929 // const root = await window.showDirectoryPicker()
3030 // db = await initSQLite(useIdbMemoryStorage('test.db', { url }))
@@ -37,6 +37,9 @@ document.querySelector('.main')?.addEventListener('click', async () => {
3737 sqliteModule : db . sqliteModule . _sqlite3_libversion_number ( ) ,
3838 sql : ( await db . run ( 'select sqlite_version() as a' ) ) [ 0 ] . a ,
3939 } )
40+ await db . close ( )
41+ } )
42+ document . querySelector ( '.main-memory' ) ?. addEventListener ( 'click' , async ( ) => {
4043 await runSQL ( ( await initSQLite ( useMemoryStorage ( { url : syncUrl } ) ) ) . run )
4144} )
4245document . querySelector ( '.import' ) ?. addEventListener ( 'click' , async ( ) => {
@@ -163,7 +166,7 @@ document.querySelector('.clear')?.addEventListener('click', async () => {
163166 console . log ( 'clear all IndexedDB' )
164167} )
165168
166- function download ( buffer : Uint8Array ) : void {
169+ function download ( buffer : Uint8Array < ArrayBuffer > ) : void {
167170 const blob = new Blob ( [ buffer ] )
168171 const reader = new FileReader ( )
169172 reader . readAsDataURL ( blob )
0 commit comments