Skip to content

Commit

Permalink
Hide most console.log on production builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmitasch committed Nov 3, 2022
1 parent 68b57e0 commit cf12480
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions app/services/chataigne-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ export default class WebsocketService extends Service {

sendFeedback(address, value) {
const data = { 'controlAddress' : address, 'value': value };
console.log('Sending feedback for ' + address + ': ' + value);
devLog('Sending feedback for ' + address + ': ' + value);
this.socket.send(JSON.stringify(data));
}

send(data) {
console.log('Sending feedback : ' + JSON.stringify(data));
devLog('Sending feedback : ' + JSON.stringify(data));
this.socket.send(JSON.stringify(data));
}

handleFeedback(payload) {
console.log('Updating feedback ' + payload.controlAddress + ': ' + payload.value);
devLog('Updating feedback ' + payload.controlAddress + ': ' + payload.value);
if (!payload.type) return;

let type = getControlType(payload.type);
Expand Down Expand Up @@ -198,7 +198,7 @@ export default class WebsocketService extends Service {
}

handleUiFeedback(payload) {
console.log('Updating uiFeedback ' + payload.controlAddress + ': ' + payload.value);
devLog('Updating uiFeedback ' + payload.controlAddress + ': ' + payload.value);

if (!payload.targetType) return;

Expand Down Expand Up @@ -301,7 +301,7 @@ export default class WebsocketService extends Service {
}

legacyHandleFeedback(payload) {
console.log('Legacy Updating ' + payload.controlAddress + ': ' + payload.value);
devLog('Legacy Updating ' + payload.controlAddress + ': ' + payload.value);

this.store.peekAll('texture').forEach(function(item) {
if (item.itemControlAddress == payload.controlAddress) {
Expand Down Expand Up @@ -467,4 +467,9 @@ function getControlType(type) {
}
return type;
}


function devLog(s) {
if (ENV.environment == 'development') {
console.log(s);
}
}

0 comments on commit cf12480

Please sign in to comment.