Files
Jeffrey PosnickandGitHub 7d4c4434a4 Enable prettier (#2929)
* Deps and config

* Prettier output

* Update hardcoded file sizes

* More file size updates
2021-08-26 14:57:20 -07:00

41 lines
1.0 KiB
HTML

<html>
<head>
<meta charset="UTF-8" />
</head>
<body>
<p>Log time of isURLExpired();</p>
<script>
// Fakery to make it load in the window
self.registration = {
scope: 'inject-scope',
};
</script>
<script src="../../../../packages/workbox-core/build/browser/workbox-core.dev.js"></script>
<script src="../../../../packages/workbox-expiration/build/browser/workbox-expiration.dev.js"></script>
<script>
const CacheExpiration = workbox.expiration.CacheExpiration;
const expirationManager = new CacheExpiration('cache-name', {
maxAgeSeconds: 2,
});
expirationManager.updateTimestamp('/', Date.now());
const test = async () => {
const t0 = performance.now();
const expired = await expirationManager.isURLExpired('/');
const t1 = performance.now();
console.log(
`Call to doSomething took "${t1 - t0}" milliseconds.`,
expired,
);
};
test();
setTimeout(test, 2000);
</script>
</body>
</html>