Skip to content

Commit

Permalink
Update for BackgroundFetchEvent & BackgroundFetchUpdateUIEvent (#…
Browse files Browse the repository at this point in the history
…32163)

* update

* update

* update inherit info

* Apply suggestions from code review

* Apply suggestions from code review

* Update files/en-us/web/api/backgroundfetchevent/index.md

---------

Co-authored-by: Brian Thomas Smith <[email protected]>
  • Loading branch information
skyclouds2001 and bsmth committed Apr 11, 2024
1 parent f0e711d commit e48b0ac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
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

0 comments on commit e48b0ac

Please sign in to comment.