【问题标题】:How can I configure Cache then network with SW Precache?如何使用 SW Precache 配置缓存然后网络?
【发布时间】:2019-02-13 20:07:10
【问题描述】:

我只找到了两个接受此插件的选项,即 cacheFirst 和 networkFirst,但我找不到 Cache 然后网络获取更新的选项。

    { 
      urlPattern: /^https:\/\/mlm-s2-p\.mlstatic\.com/,
      handler: 'cacheFirst',
    options: {
        cache: {
            maxEntries: 1000,
            name: 'mercadolibre-images-cache-s2c'
          }
      }
    },

【问题讨论】:

标签: javascript service-worker progressive-web-apps sw-precache


【解决方案1】:

handler: 'fastest' 会给你你想要的行为。这对应于sw-toolbox 中的fastest 处理程序:https://googlechromelabs.github.io/sw-toolbox/api.html#toolboxfastest

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    • 2018-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多