Skip to content

Instantly share code, notes, and snippets.

@ibeeger
Last active June 22, 2018 08:59
Show Gist options
  • Save ibeeger/1b187b7623079c71b279ebe794613105 to your computer and use it in GitHub Desktop.
Save ibeeger/1b187b7623079c71b279ebe794613105 to your computer and use it in GitHub Desktop.
个人理解

service worker能干什么

  1. 缓存文件
  2. 离线工作 可能对h5小游戏来说更有价值吧(个人见解,想象空间还是蛮大的,可以看)

工作流程

  1. 安装 install 安装过程中会把提前设置的资源地址缓存到用户端
  2. 激活 activte 每次激活会对比缓存的版本信息,如果不同会删除 当前版本的缓存信息
  3. 过滤 用户端请求地址的时候 如果资源地址在缓存列表内就可以直接从缓存去,直接减少请求。

注意

https://75team.com/post/lifecycle.html#toc-78a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment