BackgroundFetchUpdateUIEvent.updateUI()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
BackgroundFetchUpdateUIEvent
インターフェイスの updateUI()
メソッドは、 UI 上のタイトルとアイコンを更新し、バックグラウンドのフェッチの成否を表示します。
このメソッドは一度だけ実行され、フェッチの成否をユーザーに通知することができます。
構文
js
updateUI(options)
引数
返値
Promise
。
例外
InvalidStateError
DOMException
-
以下のいずれかに当てはまるとき、発生します。
isTrusted
プロパティがfalse
のとき。BackgroundFetchUpdateUIEvent
UI 更新のフラグがすでにセットされている、すなわち、すでにupdateUI()
メソッドが呼ばれたあとであるとき。BackgroundFetchUpdateUIEvent
がアクティブではないとき。
例
以下の例では、フェッチ成功時に UI のタイトルとアイコン画像を更新しています。
js
addEventListener("backgroundfetchsuccess", (event) => {
event.updateUI({
title: "Episode 5 ready to listen!",
icon: {
src: "path/to/success.ico",
sizes: "16x16 32x32 64x64",
},
});
});
仕様書
Specification |
---|
Background Fetch # background-fetch-update-ui-event-update-ui |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
updateUI |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.