demo/wasm-util.js
function storeInDatabase(db, module) {
    var store = db.transaction([storeName], 'readwrite').objectStore(storeName);
    try {
      var request = store.put(module, url);
      request.onerror = err => { console.log(`Failed to store in wasm cache: ${err}`) };
      request.onsuccess = err => { console.log(`Successfully stored ${url} in wasm cache`) };
    } catch (e) {
      console.warn('An error was thrown... in storing wasm cache...');
      console.warn(e);
    }
  }
function storeInDatabase(db, module) {
    var store = db.transaction([storeName], 'readwrite').objectStore(storeName);
    try {
      var request = store.put(module, url);
      request.onerror = err => { console.log(`Failed to store in wasm cache: ${err}`) };
      request.onsuccess = err => { console.log(`Successfully stored ${url} in wasm cache`) };
    } catch (e) {
      console.warn('An error was thrown... in storing wasm cache...');
      console.warn(e);
    }
  }
function storeInDatabase ( db , module ) { var store = db . transaction ( [ storeName ] , 'readwrite' ) . objectStore ( storeName ) ; try { var request = store . put ( module , url ) ; request . onerror = err => { console . log ( ` ${ err } ` ) } ; request . onsuccess = err => { console . log ( ` ${ url } ` ) } ; } catch ( e ) { console . warn ( 'An error was thrown... in storing wasm cache...' ) ; console . warn ( e ) ; } }
This helper function fires off an async operation to store the given wasm Module in the given IDBDatabase.
This helper function fires off an async operation to store the given wasm Module in the given IDBDatabase .