DEV Community

Creating a VueJS component for online/offline events

Julien Calixte on November 14, 2019

Hi folks! I've recently created a node module and I thought it could be interesting to review it together, if you want to publish a component that...
Collapse
 
xowap profile image
Rémy 🤖

I'm not sure to understand, what is the problem that you are trying to solve? Is this a common pattern?

Collapse
 
jcalixte profile image
Julien Calixte

Hi!
You're right, I think I can be more precise on why to use this component.
This component can be useful when your app needs to display different things when the user is online and when he is offline. For example, I'm currently developing a PWA that stores articles for offline reading. With the component vue-online-offline, I can tell to an other <ArticleList /> component to stop fetching the API and only display articles stored locally. This way, I only display articles to the user he will be able to read.

More simple, it can be used to display or not an offline icon.

Is this more comprehensible?