Change string concats to template literals

This commit is contained in:
Sam Schloegel
2022-01-03 14:31:13 -05:00
parent c5691b56c9
commit aec191e178
11 changed files with 47 additions and 80 deletions
+4 -4
View File
@@ -32,7 +32,7 @@ exports.data = function (device, osc) {
this.deviceInfoUpdate(device, 'defaultName', osc.args[0]);
} else if (osc.address == '/eos/out/get/cuelist/count') {
for (var i = 0; i < osc.args[0]; i++) {
device.send('/eos/get/cuelist/index/' + i);
device.send(`/eos/get/cuelist/index/${i}`);
}
} else if (
p[1] == 'out' &&
@@ -41,7 +41,7 @@ exports.data = function (device, osc) {
p[5] == 'list'
) {
device.data.cuelists[p[4]] = {};
device.send('/eos/get/cue/' + p[4] + '/count');
device.send(`/eos/get/cue/${p[4]}/count`);
} else if (
p[1] == 'out' &&
p[2] == 'get' &&
@@ -49,7 +49,7 @@ exports.data = function (device, osc) {
p[5] == 'count'
) {
for (var i = 0; i < osc.args[0]; i++) {
device.send('/eos/get/cue/' + p[4] + '/index/' + i);
device.send(`'/eos/get/cue/${p[4]}/index/${i}`);
}
} else if (
p[1] == 'out' &&
@@ -124,7 +124,7 @@ exports.data = function (device, osc) {
var listCount = p[7];
var cueNumber = osc.args[1];
device.send('/eos/get/cue/' + cueList + '/' + cueNumber);
device.send(`/eos/get/cue/${cueList}/${cueNumber}`);
//console.log("SENT /eos/get/cue/"+cueList+"/"+cueNumber);
} else if (
p[2] == 'cmd' ||
+3 -5
View File
@@ -25,10 +25,9 @@ exports.data = function (device, message) {
const md5 = require('md5');
if (msg.substring(0, 8) == 'PJLINK 1') {
password = md5(msg.substring(9, 17) + 'JBMIAProjectorLink');
password = md5(`${msg.substring(9, 17)}JBMIAProjectorLink`);
device.send(
password +
'%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r'
`${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
);
}
if (msg.substring(0, 7) == '%1POWR=') {
@@ -115,8 +114,7 @@ function processPJLink(device, str, that) {
exports.heartbeat = function (device) {
if (password) {
device.send(
password +
'%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r'
`${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
);
}
};
+6 -12
View File
@@ -25,12 +25,12 @@ exports.data = function (device, osc) {
selectionIsPlayhead: true,
};
device.data.version = d[i].version;
device.send('/workspace/' + d[i].uniqueID + '/cueLists');
device.send('/workspace/' + d[i].uniqueID + '/updates', [
device.send(`/workspace/${d[i].uniqueID}/cueLists`);
device.send(`/workspace/${d[i].uniqueID}/updates`, [
{ type: 'i', value: 1 },
]);
device.send('/cue/playbackPosition/uniqueID');
device.send('/workspace/' + d[i].uniqueID + '/selectionIsPlayhead');
device.send(`/workspace/${d[i].uniqueID}/selectionIsPlayhead`);
}
} else if (p[1] == 'workspace' && p[3] == 'cueLists') {
var workspace = p[2];
@@ -59,11 +59,7 @@ exports.data = function (device, osc) {
cue.groups = groups;
device.send(
'/workspace/' +
workspace +
'/cue_id/' +
cue.uniqueID +
'/valuesForKeys',
`/workspace/${workspace}/cue_id/${cue.uniqueID}/valuesForKeys`,
[
{
type: 's',
@@ -89,7 +85,7 @@ exports.data = function (device, osc) {
device.draw();
} else if (p[0] == 'update' && p[1] == 'workspace' && p[3] == 'cue_id') {
device.send('/workspace/' + p[2] + '/cueLists');
device.send(`/workspace/${p[2]}/cueLists`);
} else if (
p[0] == 'update' &&
p[1] == 'workspace' &&
@@ -143,8 +139,6 @@ exports.data = function (device, osc) {
exports.heartbeat = function (device) {
try {
device.send(
'/workspace/' + Object.keys(device.data.workspaces)[0] + '/thump'
);
device.send(`/workspace/${Object.keys(device.data.workspaces)[0]}/thump`);
} catch (err) {}
};
+1 -1
View File
@@ -27,7 +27,7 @@ exports.data = function (device, message) {
var i = 0;
while (arr[i][arr[i].length - 1] != '"') {
i++;
device.data.showName += arr[i] + ' ';
device.data.showName += `${arr[i]} `;
}
device.data.showName = device.data.showName.substring(
1,
+6 -8
View File
@@ -48,9 +48,9 @@ exports.data = function (device, buf) {
for (var i = 0; i <= 32; i++) {
device.send(
Buffer.from(
'/ch/' +
i.toString().padStart(2, '0') +
'/config/name\u0000\u0000\u0000\u0000'
`/ch/${i
.toString()
.padStart(2, '0')}/config/name\u0000\u0000\u0000\u0000`
)
);
}
@@ -85,7 +85,7 @@ exports.data = function (device, buf) {
}
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/mix/fader\u0000\u0000\u0000\u0000')
Buffer.from(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`)
);
} else if (msg[0].indexOf('/config/name') > 0) {
var addr = parseAddress(msg[0]);
@@ -93,16 +93,14 @@ exports.data = function (device, buf) {
device.data.channelNames[channel - 1] = msg[2];
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/config/color\u0000\u0000\u0000\u0000')
Buffer.from(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`)
);
} else if (msg[0].indexOf('/config/color') > 0) {
var addr = parseAddress(msg[0]);
var channel = Number(addr[1]);
device.data.channelColors[channel - 1] = buf.readInt8(27);
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/mix/on\u0000\u0000\u0000\u0000')
);
device.send(Buffer.from(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`));
} else {
//console.log(msg)
}
+6 -8
View File
@@ -53,9 +53,9 @@ exports.data = function (device, buf) {
for (var i = 0; i <= 32; i++) {
device.send(
Buffer.from(
'/ch/' +
i.toString().padStart(2, '0') +
'/config/name\u0000\u0000\u0000\u0000'
`/ch/${i
.toString()
.padStart(2, '0')}/config/name\u0000\u0000\u0000\u0000`
)
);
}
@@ -90,7 +90,7 @@ exports.data = function (device, buf) {
}
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/mix/fader\u0000\u0000\u0000\u0000')
Buffer.from(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`)
);
} else if (msg[0].indexOf('/config/name') > 0) {
var addr = parseAddress(msg[0]);
@@ -98,16 +98,14 @@ exports.data = function (device, buf) {
device.data.channelNames[channel - 1] = msg[4];
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/config/color\u0000\u0000\u0000\u0000')
Buffer.from(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`)
);
} else if (msg[0].indexOf('/config/color') > 0) {
var addr = parseAddress(msg[0]);
var channel = Number(addr[1]);
device.data.channelColors[channel - 1] = buf.readInt8(27);
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/mix/on\u0000\u0000\u0000\u0000')
);
device.send(Buffer.from(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`));
} else {
//console.log(msg)
}