aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/cachestorage
diff options
context:
space:
mode:
authorThomas Citharel <github@tcit.fr>2021-05-08 14:41:17 +0200
committerGitHub <noreply@github.com>2021-05-08 14:41:17 +0200
commit3b0f3b4310d7cad3bd61d0fbfcbc2f81d9cc6713 (patch)
tree22573e424d7a29b5e8c15beceffd8a96c5d2ec0c /files/zh-cn/web/api/cachestorage
parent9d44c5f911d2e22da70737c1576f6e065bebab57 (diff)
downloadtranslated-content-3b0f3b4310d7cad3bd61d0fbfcbc2f81d9cc6713.tar.gz
translated-content-3b0f3b4310d7cad3bd61d0fbfcbc2f81d9cc6713.tar.bz2
translated-content-3b0f3b4310d7cad3bd61d0fbfcbc2f81d9cc6713.zip
Fix a typo in the example for CacheStorage.keys() (#781)
Follow-up to https://github.com/mdn/content/pull/4790 on the main repo Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'files/zh-cn/web/api/cachestorage')
-rw-r--r--files/zh-cn/web/api/cachestorage/keys/index.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/files/zh-cn/web/api/cachestorage/keys/index.html b/files/zh-cn/web/api/cachestorage/keys/index.html
index 8d174f9c2c..57f7148a28 100644
--- a/files/zh-cn/web/api/cachestorage/keys/index.html
+++ b/files/zh-cn/web/api/cachestorage/keys/index.html
@@ -26,7 +26,7 @@ translation_of: Web/API/CacheStorage/keys
<p>在此代码片段中,我们监听{{domxref("ServiceWorkerGlobalScope.onactivate", "activate")}} 事件,然后运行一个 {{domxref("ExtendableEvent.waitUntil","waitUntil()")}} 方法,该方法在新的 service worker 被激活之前清除老的、无用的cache。 这里我们设置一个包含缓存名称的白名单。 通过使用 <code>keys()方法</code> 来返回{{domxref("CacheStorage")}} 对象中的keys集合,然后检查缓存key是否在白名单中,如果不存在,则使用 {{domxref("CacheStorage.delete")}} 方法来删除该缓存。</p>
-<pre class="brush: js">then.addEventListener('activate', function(event) {
+<pre class="brush: js">this.addEventListener('activate', function(event) {
var cacheWhitelist = ['v2'];
event.waitUntil(