DEV Community

0 seconds of 5 minutes, 57 secondsVolume 90%
Press shift question mark to access a list of keyboard shortcuts
00:00
00:00
05:57
 
James Bubb
James Bubb

Posted on

6 3

Using JavaScript Online / Offline Events

Originally published here on YouTube.
(Please give me a thumbs up and subscribe if you found this useful or follow me on Twitter: https://www.twitter.com/codebubb 🙏).

00:00 Introduction
00:34 The navigator object
01:28 Setting up events
02:39 Updating a UI
05:00 Connection speed

So we'll start off our JavaScript tutorial by looking at the Navigator object and see how you can use the onLine property to determine the user's current network status.

Then we'll move on to looking at the JavaScript Online Offline events and see how you can set up a couple of simple event listeners to detect when the user's network connection changes.

Once you understand how the two JavaScript Online Offline events work, we'll create a simple example that demonstrates how to update a bit of UI to display to the user the status of the current network connection.

Finally, we'll take a look at the connection property that's also available on the Navigator object and see how you can use this to gain further information about a user's network connection.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (2)

Collapse
 
zippytyro profile image
Shashwat Verma

that was really helpful.

Collapse
 
codebubb profile image
James Bubb

Cheers! Glad you found it useful.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up