WorkerGlobalScope: online イベント
online
は WorkerGlobalScope
のイベントで、端末がインターネットに再接続したときに発行されます。
構文
このイベント名を addEventListener()
などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。
js
addEventListener("online", (event) => {});
ononline = (event) => {};
イベント型
一般的な Event
です。
例
次のコードでは、ワーカーに ononline
ハンドラーを設定しています。
js
self.ononline = () => {
console.log("Your worker is now online");
};
同じスニペットですが、 addEventListener()
を使用したものです。
js
self.addEventListener("online", () => {
console.log("Your worker is now online");
});
仕様書
Specification |
---|
HTML # handler-workerglobalscope-ononline |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
online event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
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.
関連情報
The WorkerGlobalScope
interface it belongs to.