A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
[npm library] @bugsounet/internet
-
@bugsounet/internet
I created this library if you want to check internet connexion in your module.
This library is very simplified and ready for use in yournode_helper.jsThis library is used in MMM-Assistant2Display
single node routine for checking internet status
Installation
npm install @bugsounet/internetSample with pir contructor
const Internet = require("@bugsounet/internet") this.config = { delay: 10 * 1000, scan: "google.com", command: "pm2 restart 0", showAlert: true } var debug = true this.internet = new Internet(this.config, callback, debug) this.internet.start() setTimeout(() => { this.internet.stop() } , 60 * 1000) function callback(status, value) { if (status == "INTERNET_PING") console.log ("Ping:", value) if (status == "INTERNET_DOWN") console.log ("Conexion lost... Retry:", value) if (status == "INTERNET_RESTART") console.log ("Internet is back") }constructor of internet
internet(internetConfig, callback, debug)
internetConfig {}
delay- set the interval for internet checking.scan- ping point name or address.command- command to execute when internet afresh availableshowAlert- send a callback Alert about internet connection lost and available
callback (status,value)
INTERNET_PING- return current ping with valueINTERNET_DOWN- return internet down status with number of retry in valueINTERNET_RESTART- return internet available status
INTERNET_DOWNandINTERNET_RESTARTwill be sended only ifshowAlertfeature is enabledebug
if you want debuging information, just set to
trueFunctions
start(): start internet scanstop(): force stop scan
-
Wow. You’ve been busy.
-
it’s just my personal npm libraries :)
I have 3 more … but i have to Make readme file (too lazy actually) :p
