From 4f6e9f8b55130f959975e2d9641c55f2366a537d Mon Sep 17 00:00:00 2001 From: Oliver Dunk Date: Tue, 31 Oct 2023 15:29:08 +0000 Subject: [PATCH] Apply suggestions from code review Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com> --- api-samples/readingList/README.md | 9 ++++++++- api-samples/readingList/index.js | 2 +- api-samples/readingList/manifest.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/api-samples/readingList/README.md b/api-samples/readingList/README.md index 09ffa3018a..a937b93282 100644 --- a/api-samples/readingList/README.md +++ b/api-samples/readingList/README.md @@ -4,10 +4,17 @@ This sample demonstrates using the [chrome.readingList](https://developer.chrome ## Overview -Once this extension is installed, clicking this extension's action icon will open an extension page. +The extension's action icon opens a page that allows you to add new items, as well as update or delete existing ones. Screenshot showing the chrome.readingList API demo running in Chrome. +## Running this extension + +1. Clone this repository. +2. Load this directory in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked). +3. Click on the action icon. +4. An extension page will open. + ## Implementation Notes Listeners are added for all events, so the table automatically updates when data in the reading list changes. diff --git a/api-samples/readingList/index.js b/api-samples/readingList/index.js index 6a44bdb488..e5ca1a1212 100644 --- a/api-samples/readingList/index.js +++ b/api-samples/readingList/index.js @@ -59,7 +59,7 @@ async function updateUI() { for (const item of items) { // Use existing row if possible, otherwise create a new one. const row = - document.querySelector(`[data-url="${item.url}"`) || + document.querySelector(`[data-url="${item.url}"]`) || document.getElementById(TABLE_ITEM_TEMPLATE_ID).content.cloneNode(true) .children[0]; diff --git a/api-samples/readingList/manifest.json b/api-samples/readingList/manifest.json index b5bd715a5f..4c15bbaa7e 100644 --- a/api-samples/readingList/manifest.json +++ b/api-samples/readingList/manifest.json @@ -2,7 +2,7 @@ "name": "Reading List API Demo", "version": "1.0", "manifest_version": 3, - "description": "Uses the chrome.readingList API to display reading list entries.", + "description": "Uses the chrome.readingList API to display, update and remove reading list entries.", "background": { "service_worker": "sw.js" },