client-online-status
v0.3.1
Published
Network Status Checker for Browser Client
Downloads
3
Maintainers
Readme
client-online-status
Client Online Status Checker
Overview
This is a tool for checking if the user (client) is currently online on various platforms like web browsers, mobile devices etc., displaying real-time updates via console logs or customized UI elements in your applications.
Installation
To install it as an npm dependency:
npm install client-online-status
Usage
To use it in your project, import it at the top of your JavaScript file(s) and initialize with required settings.
Example (displaying status on console):
const { clientOnlineStatus } = require('client-online-status');
document.addEventListener('DOMContentLoaded', function() {
clientOnlineStatus();
setInterval(function() {
if (window.CONNECTION_STATE == 'CONNECTED') {
console.log('You are online');
}
}, 1000);
});