eslint fix prefer-arrow-callback errors

This commit is contained in:
Sam Schloegel
2022-01-03 14:48:13 -05:00
parent 83c46db661
commit d0dc2380ea
5 changed files with 40 additions and 49 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ const createWindow = () => {
app.whenReady().then(() => {
createWindow();
app.on('activate', function () {
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
@@ -78,7 +78,7 @@ ipcMain.on('disableSearchAll', (event, arg) => {
menu.getMenuItemById('deviceSearch').enabled = false;
});
ipcMain.on('setDevicePin', function (event, arg) {
ipcMain.on('setDevicePin', (event, arg) => {
menu.getMenuItemById('devicePin').checked = arg;
});
+8 -8
View File
@@ -20,7 +20,7 @@ window.init = function () {
ipcRenderer.send('enableDeviceDropdown');
ipcRenderer.send('enableSearchAll');
PLUGINS.init(function () {
PLUGINS.init(() => {
VIEW.init();
SAVESLOTS.loadDevices();
SAVESLOTS.loadSlot(1);
@@ -138,7 +138,7 @@ window.init = function () {
};
};
ipcRenderer.on('setActiveDevicePinned', function (event, message) {
ipcRenderer.on('setActiveDevicePinned', (event, message) => {
if (!message) {
VIEW.unpinActiveDevice();
} else {
@@ -146,25 +146,25 @@ ipcRenderer.on('setActiveDevicePinned', function (event, message) {
}
});
ipcRenderer.on('doSearch', function (event, message) {
ipcRenderer.on('doSearch', (event, message) => {
window.searchAll();
});
ipcRenderer.on('doDelete', function (event, message) {
ipcRenderer.on('doDelete', (event, message) => {
DEVICE.deleteActive();
});
ipcRenderer.on('resetViews', function (event, message) {
ipcRenderer.on('resetViews', (event, message) => {
SAVESLOTS.resetSlots();
});
ipcRenderer.on('doSlots1', function (event, message) {
ipcRenderer.on('doSlots1', (event, message) => {
SAVESLOTS.loadSlot(1);
});
ipcRenderer.on('doSlots2', function (event, message) {
ipcRenderer.on('doSlots2', (event, message) => {
SAVESLOTS.loadSlot(2);
});
ipcRenderer.on('doSlots3', function (event, message) {
ipcRenderer.on('doSlots3', (event, message) => {
SAVESLOTS.loadSlot(3);
});
+12 -17
View File
@@ -91,17 +91,17 @@ initDeviceConnection = function (id) {
port: device.port,
});
device.connection.open();
device.connection.on('error', function (error) {
device.connection.on('error', (error) => {
// console.error(error)
device.connection.close();
});
device.connection.on('ready', function () {
device.connection.on('ready', () => {
plugins[type].ready(device);
if (Object.keys(devices).length == 1) {
VIEW.switchDevice(device.id);
}
});
device.connection.on('message', function (message) {
device.connection.on('message', (message) => {
// log("OSC IN", message.address);
plugins[type].data(device, message);
device.lastMessage = Date.now();
@@ -115,19 +115,19 @@ initDeviceConnection = function (id) {
device.connection.connect(
{ port: device.port, host: device.addresses[0] },
function () {}
() => {}
);
device.connection.on('error', function (error) {
device.connection.on('error', (error) => {
// console.error(error)
});
device.connection.on('ready', function () {
device.connection.on('ready', () => {
plugins[type].ready(device);
if (Object.keys(devices).length == 1) {
VIEW.switchDevice(device.id);
}
});
device.connection.on('data', function (message) {
device.connection.on('data', (message) => {
// log("SOCK IN", message);
plugins[type].data(device, message);
device.lastMessage = Date.now();
@@ -140,24 +140,19 @@ initDeviceConnection = function (id) {
} else if (plugins[type].connectionType == 'UDPsocket') {
device.connection = udp.createSocket('udp4');
device.connection.bind(function () {
device.connection.bind(() => {
plugins[type].ready(device);
device.connection.on('message', function (msg, info) {
device.connection.on('message', (msg, info) => {
plugins[type].data(device, msg);
infoUpdate(device, 'status', 'ok');
});
});
device.send = function (data) {
device.connection.send(
data,
device.port,
device.addresses[0],
function (err) {
// console.log(err);
}
);
device.connection.send(data, device.port, device.addresses[0], (err) => {
// console.log(err);
});
};
}
};
+1 -1
View File
@@ -8,7 +8,7 @@ module.exports.all = allPlugins;
module.exports.init = function (callback) {
console.log(`Loading plugin files... ${__dirname}/../plugins`);
fs.readdir(`${__dirname}/../plugins`, function (err, files) {
fs.readdir(`${__dirname}/../plugins`, (err, files) => {
for (var i in files) {
var plugin = files[i];
+17 -21
View File
@@ -66,7 +66,7 @@ searchAll = function () {
// searchTCP();
// searchUDP();
setTimeout(function () {
setTimeout(() => {
searching = false;
document.getElementById('search-button').style.opacity = '';
@@ -91,7 +91,7 @@ module.exports.searchAll = searchAll;
// |__/
newSearchBonjour = function (pluginType, plugin) {
bonjour.find({ type: plugin.searchOptions.bonjourName }, function (e) {
bonjour.find({ type: plugin.searchOptions.bonjourName }, (e) => {
console.log(pluginType);
var validAddresses = [];
@@ -141,19 +141,15 @@ newSearchTCP = function (pluginType, plugin) {
};
TCPtest = function (ip, pluginType, plugin) {
var client = net.createConnection(
plugin.searchOptions.testPort,
ip,
function () {
client.write(plugin.searchOptions.searchBuffer);
// DEVICE.registerDevice({
// type: pluginType,
// defaultName: plugin.defaultName,
// port: plugin.defaultPort,
// addresses: [ip]
// })
}
);
var client = net.createConnection(plugin.searchOptions.testPort, ip, () => {
client.write(plugin.searchOptions.searchBuffer);
// DEVICE.registerDevice({
// type: pluginType,
// defaultName: plugin.defaultName,
// port: plugin.defaultPort,
// addresses: [ip]
// })
});
client.on('data', (data) => {
if (plugin.searchOptions.validateResponse(data)) {
DEVICE.registerDevice({
@@ -165,7 +161,7 @@ TCPtest = function (ip, pluginType, plugin) {
}
client.end();
});
client.on('error', function (err) {
client.on('error', (err) => {
// no device here
});
};
@@ -295,7 +291,7 @@ var searchSockets = [];
newSearchUDP = function (pluginType, plugin) {
var i = searchSockets.push(dgram.createSocket('udp4')) - 1;
searchSockets[i].bind(plugin.searchOptions.listenPort, function () {
searchSockets[i].bind(plugin.searchOptions.listenPort, () => {
searchSockets[i].send(
plugin.searchOptions.searchBuffer,
plugin.searchOptions.devicePort,
@@ -304,7 +300,7 @@ newSearchUDP = function (pluginType, plugin) {
// console.log(err)
}
);
setTimeout(function () {
setTimeout(() => {
searchSockets[i].send(
plugin.searchOptions.searchBuffer,
plugin.searchOptions.devicePort,
@@ -314,7 +310,7 @@ newSearchUDP = function (pluginType, plugin) {
}
);
}, 100);
setTimeout(function () {
setTimeout(() => {
searchSockets[i].send(
plugin.searchOptions.searchBuffer,
plugin.searchOptions.devicePort,
@@ -325,7 +321,7 @@ newSearchUDP = function (pluginType, plugin) {
);
}, 400);
searchSockets[i].on('message', function (msg, info) {
searchSockets[i].on('message', (msg, info) => {
if (plugin.searchOptions.validateResponse(msg, info)) {
DEVICE.registerDevice({
type: pluginType,
@@ -336,7 +332,7 @@ newSearchUDP = function (pluginType, plugin) {
}
});
});
searchSockets[i].on('listening', function () {
searchSockets[i].on('listening', () => {
searchSockets[i].setBroadcast(true);
});
};