mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-14 02:03:39 +00:00
change templates to ejs
This commit is contained in:
+18
-10
@@ -54,13 +54,16 @@ registerDevice = function (newDevice) {
|
||||
lastDrawn: 0,
|
||||
lastHeartbeat: 0,
|
||||
heartbeatInterval: PLUGINS.all[newDevice.type].heartbeatInterval,
|
||||
draw: debounce(
|
||||
function () {
|
||||
VIEW.draw(this);
|
||||
},
|
||||
30,
|
||||
{ leading: true, trailing: true }
|
||||
),
|
||||
draw: async function(){
|
||||
VIEW.draw(this);
|
||||
},
|
||||
update: function(type, data){
|
||||
if(this.drawn){
|
||||
VIEW.update(this, type, data);
|
||||
}else{
|
||||
this.draw();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
VIEW.addDeviceToList(devices[id]);
|
||||
@@ -68,6 +71,7 @@ registerDevice = function (newDevice) {
|
||||
};
|
||||
module.exports.registerDevice = registerDevice;
|
||||
|
||||
|
||||
initDeviceConnection = function (id) {
|
||||
const device = devices[id];
|
||||
|
||||
@@ -101,8 +105,12 @@ initDeviceConnection = function (id) {
|
||||
}
|
||||
});
|
||||
device.connection.on('message', (message) => {
|
||||
// log("OSC IN", message.address);
|
||||
plugins[type].data(device, message);
|
||||
try{
|
||||
plugins[type].data(device, message);
|
||||
}catch(err){
|
||||
console.error("Error with plugin 'data' function");
|
||||
console.error(err)
|
||||
}
|
||||
device.lastMessage = Date.now();
|
||||
});
|
||||
device.send = function (address, args) {
|
||||
@@ -242,7 +250,7 @@ function heartbeat() {
|
||||
if (Date.now() >= device.lastHeartbeat + device.heartbeatInterval) {
|
||||
if (device.status == 'broken') {
|
||||
initDeviceConnection(i);
|
||||
} else if (Date.now() - device.lastMessage > 10000) {
|
||||
} else if (Date.now() - device.lastMessage > device.heartbeatTimeout) {
|
||||
infoUpdate(device, 'status', 'broken');
|
||||
} else {
|
||||
if (device.port != undefined && device.addresses.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user