<!DOCTYPE html>
<html>
<head>
<title>Content Index API Test</title>
<script src="../format_error.js"></script>
</head>
<body>
<h1>Content Index Test</h1>
<script>
navigator.serviceWorker.register('sw.js');
async function addContent(id, icons = [], url = '/content_index/test.html') {
try {
const registration = await navigator.serviceWorker.ready;
await registration.index.add({
id,
title: 'Title!',
description: 'Description!',
category: 'article',
icons,
url,
});
return 'ok';
} catch (e) {
return formatError(e);
}
}
</script>
</body>
</html>