files/en-us/web/api/backgroundfetchupdateuievent/updateui/index.md
{{APIRef("Background Fetch API")}}{{SeeCompatTable}}{{AvailableInWorkers("service")}}
The updateUI() method of the {{domxref("BackgroundFetchUpdateUIEvent")}} interface updates the title and icon in the user interface to show the status of a background fetch.
This method may only be run once, to notify the user on a failed or a successful fetch.
updateUI()
updateUI(options)
options {{optional_inline}}
icons {{optional_inline}}
src
sizes {{optional_inline}}
sizes attribute of the {{HTMLElement("link")}} element.type {{optional_inline}}
label {{optional_inline}}
title {{optional_inline}}
A {{jsxref("Promise")}}.
InvalidStateError {{domxref("DOMException")}}
false.updateUI() method has already been called.The following example demonstrates updating the UI with a title and image icon on a successful fetch.
addEventListener("backgroundfetchsuccess", (event) => {
event.updateUI({
title: "Episode 5 ready to listen!",
icon: {
src: "path/to/success.ico",
sizes: "16x16 32x32 64x64",
},
});
});
{{Specifications}}
{{Compat}}