<commit_before>---
layout: post
type: post
title: Worker
---

本文试图解答一下几个问题：

* Service Workers 是什么？它能解决哪些问题？
* Service Workers 和 Web Workers 有关系吗？（这本来可能不是一个问题，但确实有人提出过。）<commit_msg>What are service workers<commit_after>---
layout: post
type: post
title: Worker
---

# 本文试图解答几个小问题

* Service Workers 是什么？它能解决哪些问题？
* Service Workers 和 Web Workers 有关系吗？（这本来可能不是一个问题，但确实有人提出过。）

先来看看业界是如何评说：

> [Service Workers 让 Web 应用感觉更像是原生应用](http://www.infoq.com/cn/news/2014/12/service-workers-make-web-native)

# Service Workers 是什么？

> 简单的说 Service Workers 就是一个生命周期短暂的、事件驱动的后台线程，它处理来自系统和被其控制的页面的事件。[WebApp与Native App再战一轮？](http://tech.163.com/15/0709/09/AU2R65MF000948V8.html)

> At their simplest, Service Workers are scripts that act as client-side proxies for web pages. [ServiceWorkers and Firefox](https://hacks.mozilla.org/2014/06/serviceworkers-and-firefox/)

> A service worker is a method that enables applications to take advantage of persistent background processing, including hooks to enable bootstrapping of web applications while offline. [Service Workers -- W3C Working Draft 25 June 2015](http://www.w3.org/TR/2015/WD-service-workers-20150625/)
{'fraction_non_alphanumeric': 0.10879025239338555, 'fraction_numerical': 0.04612706701479547, 'mean_word_length': 5.216216216216216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2462576', 'n_tokens_mistral': 527, 'n_tokens_neox': 515, 'n_words': 102}