diff --git a/src/device.js b/src/device.js index 9dc9a99..caffbbc 100644 --- a/src/device.js +++ b/src/device.js @@ -69,7 +69,7 @@ function registerDevice(newDevice) { devices[id].plugin = PLUGINS.all[newDevice.type]; if ( - Object.keys(devices[id].fields).length == 0 && + Object.keys(devices[id].fields).length === 0 && PLUGINS.all[newDevice.type].config.fields ) { PLUGINS.all[newDevice.type].config.fields.forEach((field) => { @@ -206,7 +206,7 @@ function initDeviceConnection(id) { device.send = (data) => {}; } - //device.plugin = plugins[type]; + // device.plugin = plugins[type]; return true; } diff --git a/src/plugins.js b/src/plugins.js index 39b4318..8cb4dd3 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -10,7 +10,7 @@ const allPlugins = {}; module.exports.all = allPlugins; module.exports.init = function init(callback) { - let pluginDirectoryPath = path.normalize(path.join(__dirname, `../plugins`)); + const pluginDirectoryPath = path.normalize(path.join(__dirname, `../plugins`)); console.log(`Loading plugin files... ${pluginDirectoryPath}`); @@ -48,13 +48,13 @@ module.exports.init = function init(callback) { ) ); - //if (p.heartbeatTimeout === undefined || p.heartbeatTimeout < 50) { + // if (p.heartbeatTimeout === undefined || p.heartbeatTimeout < 50) { if (p.config.heartbeatTimeout) { p.heartbeatTimeout = p.config.heartbeatInterval * 1.5; } else { p.heartbeatTimeout = 10000; } - //} + // } if (p.config.heartbeatInterval) { p.heartbeatInterval = Math.max(50, p.config.heartbeatInterval); diff --git a/src/search.js b/src/search.js index 30549c7..526ac16 100644 --- a/src/search.js +++ b/src/search.js @@ -24,7 +24,7 @@ function getServers() { if ( address.family === 'IPv4' && !address.internal && - address.address.substring(0, 3) != '169' + address.address.substring(0, 3) !== '169' ) { const subnet = ip.subnet(address.address, address.netmask); let current = ip.toLong(subnet.firstAddress); diff --git a/src/view.js b/src/view.js index 4edcbfc..8d5f499 100644 --- a/src/view.js +++ b/src/view.js @@ -214,21 +214,21 @@ function switchDevice(id) { document.getElementById('device-settings-fields').innerHTML = ''; if (activeDevice.plugin.config.fields) { - let fields = activeDevice.plugin.config.fields; + const fields = activeDevice.plugin.config.fields; fields.forEach((field) => { - let $elem = document.createElement('input'); + const $elem = document.createElement('input'); $elem.type = 'text'; $elem.value = activeDevice.fields[field.key]; // || field.value; $elem.name = field.key; - $elem.onchange = function (e) { + $elem.onchange = function onchange(e) { activeDevice.fields[field.key] = $elem.value; field.action(activeDevice); saveAll(); }; - if (field.type == 'textinput') { - let rowHTML = `${field.label}:`; + if (field.type === 'textinput') { + const rowHTML = `${field.label}:`; document .getElementById('device-settings-fields') .insertAdjacentHTML('beforeend', rowHTML);