demo/wasm-util.js
function lookupInDatabase(db) {
    return new Promise((resolve, reject) => {
      var store = db.transaction([storeName]).objectStore(storeName);
      var request = store.get(url);
      request.onerror = reject.bind(null, `Error getting wasm module ${url}`);
      request.onsuccess = event => {
        if (request.result)
          resolve(request.result);
        else
          reject(`Module ${url} was not found in wasm cache`);
      }
    });
  }
function lookupInDatabase(db) {
    return new Promise((resolve, reject) => {
      var store = db.transaction([storeName]).objectStore(storeName);
      var request = store.get(url);
      request.onerror = reject.bind(null, `Error getting wasm module ${url}`);
      request.onsuccess = event => {
        if (request.result)
          resolve(request.result);
        else
          reject(`Module ${url} was not found in wasm cache`);
      }
    });
  }
function lookupInDatabase ( db ) { return new Promise ( ( resolve , reject ) => { var store = db . transaction ( [ storeName ] ) . objectStore ( storeName ) ; var request = store . get ( url ) ; request . onerror = reject . bind ( null , ` ${ url } ` ) ; request . onsuccess = event => { if ( request . result ) resolve ( request . result ) ; else reject ( ` ${ url } ` ) ; } } ) ; }
This helper function Promise-ifies the operation of looking up 'url' in the given IDBDatabase.
This helper function Promise - ifies the operation of looking up url in the given IDBDatabase .