Created
February 3, 2017 07:48
-
-
Save ConradIrwin/d1f30f90cb5e9f77856e8600bac07583 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function fillCache() { | |
caches.open('test').then(function (cache) { | |
for (var i = 0; i < 30000; i++) { | |
cache.put('https://example.com/probably-crash-' + i, new Response('ok')).then(function() { | |
filled.innerText = i; | |
}) | |
} | |
}); | |
} | |
function readCache() { | |
caches.open('test').then(function (cache) { | |
cache.keys().then(function(keys) { | |
console.log('success') | |
}).catch(function (e) { | |
alert(e); | |
}); | |
}); | |
} | |
</script> | |
<div> | |
Filling <span id="filled">...</span> | |
<button onclick="fillCache();readCache()">Crash!</button> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment