Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for BackgroundFetchEvent & BackgroundFetchUpdateUIEvent #32163

Merged
merged 7 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions files/en-us/web/api/backgroundfetchevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ browser-compat: api.BackgroundFetchEvent

{{APIRef("Background Fetch API")}}{{SeeCompatTable}}

The **`BackgroundFetchEvent`** interface of the {{domxref('Background Fetch API','','',' ')}} is the event type for background fetch events dispatched on the {{domxref("ServiceWorkerGlobalScope", "service worker global scope")}}.
The **`BackgroundFetchEvent`** interface of the {{domxref('Background Fetch API', "", "", "nocode")}} is the event type for background fetch events dispatched on the {{domxref("ServiceWorkerGlobalScope", "service worker global scope", "", "nocode")}}.

It is the event type passed to `onbackgroundfetchabort` and `onbackgroundfetchclick`.
It is the event type passed to {{domxref("ServiceWorkerGlobalScope/backgroundfetchclick_event", "backgroundfetchclick")}} event and {{domxref("ServiceWorkerGlobalScope/backgroundfetchabort_event", "backgroundfetchabort")}} event.

{{InheritanceDiagram}}

Expand All @@ -22,13 +22,15 @@ It is the event type passed to `onbackgroundfetchabort` and `onbackgroundfetchcl

## Instance properties

_Inherits properties from its ancestor, {{domxref("Event")}}_.
_Also inherits properties from its parent, {{domxref("ExtendableEvent")}}._

- {{domxref("BackgroundFetchEvent.registration")}} {{ReadOnlyInline}} {{Experimental_Inline}}
- : Returns the {{domxref("BackgroundFetchRegistration")}} that the event was initialized to.

## Instance methods

_Also inherits methods from its parent, {{domxref("ExtendableEvent")}}._

None.

## Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A {{domxref("BackgroundFetchRegistration")}}.

## Examples

In this example, if the user clicks on the user interface displaying the download progress, this fires the `onbackgroundfetchclick` event. The current {{domxref("BackgroundFetchRegistration")}} is returned by calling `event.registration`.
In this example, if the user clicks on the user interface displaying the download progress, this fires the {{domxref("ServiceWorkerGlobalScope/backgroundfetchclick_event", "backgroundfetchclick")}} event. The current {{domxref("BackgroundFetchRegistration")}} is returned by calling `event.registration`.

```js
addEventListener("backgroundfetchclick", (event) => {
Expand Down
4 changes: 3 additions & 1 deletion files/en-us/web/api/backgroundfetchupdateuievent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ The **`BackgroundFetchUpdateUIEvent`** interface of the {{domxref('Background Fe

## Instance properties

_This interface doesn't implement any specific properties, but inherits properties from {{domxref("Event")}}, and {{domxref("BackgroundFetchEvent")}}._
_Also inherits properties from its parent, {{domxref("BackgroundFetchEvent")}}._

## Instance methods

_Also inherits methods from its parent, {{domxref("BackgroundFetchEvent")}}._

- {{domxref("BackgroundFetchUpdateUIEvent.updateUI()")}} {{Experimental_Inline}}
- : Updates the title and icon in the user interface to show the status of a background fetch. Resolves with a {{jsxref("Promise")}}.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This method may only be run once, to notify the user on a failed or a successful
## Syntax

```js-nolint
updateUI()
updateUI(options)
```

Expand All @@ -33,7 +34,7 @@ updateUI(options)
- `src`
- : A string which is a URL of an image.
- `sizes` {{optional_inline}}
- : A string which is equivalent to a {{htmlelement("link")}} `sizes` attribute.
- : A string which is equivalent to the `sizes` attribute of the {{HTMLElement("link")}} element.
- `type` {{optional_inline}}
- : A string containing an image MIME type.
- `label` {{optional_inline}}
Expand All @@ -49,7 +50,7 @@ A {{jsxref("Promise")}}.
### Exceptions

- `InvalidStateError` {{domxref("DOMException")}}
- : Returned if any of the following are true:
- : Thrown if any of the following are true:
- The {{domxref("Event.isTrusted","isTrusted")}} property is `false`.
- The {{domxref("BackgroundFetchUpdateUIEvent")}} UI updated flag is already set, indicating that the `updateUI()` method has already been called.
- The {{domxref("BackgroundFetchUpdateUIEvent")}} is not active.
Expand Down