BackgroundFetchManager.get()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
get()
は BackgroundFetchManager
インターフェイスのメソッドで、引数に与えられた id
に紐づく BackgroundFetchRegistration
で解決される Promise
を返します。 id
が見つからない場合は undefined
を返します。
構文
get(id)
引数
id
-
fetch()
を呼び出すことで定義されたbackgroundFetchRegistration
の ID 。
返値
BackgroundFetchRegistration
で解決される Promise
または undefined
。
例
下記の例では、 get()
を呼び出して BackgroundFetchRegistration
を取得する方法を紹介しています。アクティブな service worker
の ServiceWorkerRegistration.backgroundFetch
を参照して BackgroundFetchManager
オブジェクトにアクセスし、その get()
メソッドを呼び出しています。
navigator.serviceWorker.ready.then(async (swReg) => {
const bgFetch = await swReg.backgroundFetch.get("my-fetch");
});
// my code block
仕様書
Specification |
---|
Background Fetch # background-fetch-manager-get |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
get |
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.