async runCachedQueries()

in src/content/lib/utils.js [135:149]


  async runCachedQueries(queries, predicate, cb) {
    try {
      // Try to get a cached response that matches the query
      const rsp = await this.matchQueries(queries);
      if (cb && predicate()) {
        await cb({ rsp, awaitingNetwork: true });
      }
    } catch (e) {}

    // Now get fresh data from network
    const rsp = await this.runQueries(queries);
    if (cb && predicate()) {
      await cb({ rsp, awaitingNetwork: false });
    }
  }