Skip to content

Commit

Permalink
Update reading_list.md
Browse files Browse the repository at this point in the history
Updated description for url properties with a brief description with what urls are allowed in the reading list.

Changes OnEntryWillBeRemoved -> OnEntryRemoved
  • Loading branch information
dlbjames authored Aug 24, 2023
1 parent 73b2e38 commit 50e0a08
Showing 1 changed file with 50 additions and 27 deletions.
77 changes: 50 additions & 27 deletions proposals/reading_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ The `browser.readingList` will introduce a few new types and functions. Below is
A ReadingListEntry is the extensions representation of a Reading List object. Where every URL stored in the Reading List must be unique.
```js
dictionary ReadingListEntry {
// The url of the entry.
// The url of the entry. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.example.com). Can contain query parameters.
DOMString url;
// The title of the entry.
DOMString title;
Expand All @@ -46,7 +47,8 @@ A ReadingListEntry is the extensions representation of a Reading List object. Wh
AddEntryOptions are the objects used to add entries into the Reading List.
```js
dictionary AddEntryOptions {
// The url of the entry.
// The url of the entry to add. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.example.com). Can contain query parameters.
DOMString url;
// The title of the entry.
DOMString title;
Expand All @@ -59,7 +61,8 @@ dictionary AddEntryOptions {
A QueryInfo is the object used to query for ReadingListEntries in the Reading List.
```js
dictionary QueryInfo {
// The url to query for.
// The url of the entry to query for. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.example.com). Can contain query parameters.
DOMString? url;
// The title to query for.
DOMString? title;
Expand All @@ -71,7 +74,8 @@ dictionary QueryInfo {
An UpdateEntryOptions is the object used to update a specific ReadingListEntry in the Reading List. A URL must be supplied.
```js
dictionary UpdateEntryOptions {
// The url that will be updated.
// The url of then entry that will be updated. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.example.com). Can contain query parameters.
DOMString url;
// The updated title.
DOMString? title;
Expand Down Expand Up @@ -147,13 +151,13 @@ The initially supported events this api will emit.
```js
static void onEntryAdded(ReadingListEntry entry);
```
### onEntryWillBeRemoved()
> Triggered when a ReadingListEntry is about to be removed from the
### onEntryRemoved()
> Triggered when a ReadingListEntry is removed from the
> reading list.
>
> |entry|: The entry that will be removed.
> |entry|: The entry that was removed.
```js
static void onEntryWillBeRemoved(ReadingListEntry entry);
static void onEntryRemoved(ReadingListEntry entry);
```
### onEntryUpdated()
Expand All @@ -174,7 +178,24 @@ The `browser.readingList` API can be available in incognito mode assuming the us
```js
namespace readingList {
dictionary ReadingListEntry {
// The url of the entry.
// The url of the entry. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.example.com). Can contain query parameters.
DOMString url;
// The title of the entry.
DOMString title;
// True if the entry has been read.
boolean hasBeenRead;
// The last update time of the entry.
// Recorded in milliseconds since Jan 1st 1970.
double lastUpdateTime;
// The creation time of the entry.
// Recorded in milliseconds since Jan 1st 1970.
double creationTime;
};

dictionary AddEntryOptions {
// The url of the entry to add. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.example.com). Can contain query parameters.
DOMString url;
// The title of the entry.
DOMString title;
Expand All @@ -183,57 +204,59 @@ namespace readingList {
};

dictionary QueryInfo {
// The url to query for.
// The url of the entry to query for. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.example.com). Can contain query parameters.
DOMString? url;
// The title to query for.
DOMString? title;
// The read status to query for.
boolean? hasBeenRead;
}
};

dictionary UpdateEntryOptions {
// The url that will be updated.
// The url of the entry to be updated. Must have a valid protocol (Ex: http, https)
// and hostname (Ex: www.google.com). Can contain query parameters.
DOMString url;
// The updated title.
DOMString? title;
// The updated read status.
boolean? hasBeenRead;
}
};

callback AddEntryCallback = void ();
callback RemoveEntryCallback = void ();
callback UpdateEntryCallback = void();
callback UpdateEntryCallback = void();
callback QueryCallback = void(ReadingListEntry[] entries);

interface Functions {
interface Functions {
// Adds an entry to the reading list if it does not exist.
[supportsPromises] static void addEntry(ReadingListEntry entry, AddEntryCallback callback);

// Removes an entry from the reading list if it exists.
[supportsPromises] static void removeEntry(QueryInfo info, RemoveEntryCallback callback);

// Retrieves all entries which match the QueryInfo properties.
// Properties which are not provided will not be matched.
// Retrieves all entries which match the QueryInfo properties. Properties which are not provided will not be matched.
[supportsPromises] static void query(QueryInfo info, QueryCallback callback);

// Updates a reading list entries title and hasBeenRead status if it exists.
[supportsPromises] static void updateEntry(UpdateEntryOptions info, UpdateEntryCallback callback);
};

interface Events {
// Triggered when a ReadingListEntry was added to the reading list.
interface Events {
// Triggered when a ReadingListEntry is added to the reading list.
// |entry|: The entry that was added.
static void onEntryAdded(ReadingListEntry entry);

// Triggered when a ReadingListEntry is about to be removed from the
// reading list.
// |entry|: The entry that will be removed.
static void onEntryWillBeRemoved(ReadingListEntry entry);
[supportsPromises] static void onEntryAdded(ReadingListEntry entry);

// Triggered when a ReadingListEntry is removed from the reading list.
// |entry|: The entry that was removed.
[supportsPromises] static void onEntryRemoved(ReadingListEntry entry);

// Triggered when a ReadingListEntry was updated in the reading list.
// |entry|: The entry that was updated.
static void onEntryUpdated(ReadingListEntry entry);
[supportsPromises] static void onEntryUpdated(ReadingListEntry entry);
};
};


```

0 comments on commit 50e0a08

Please sign in to comment.