92 }
93 }
94
95 let result = await messageController.create_message(data.sendby,data.sendto,data.content); 96 io.sockets.in(room).emit('receivemsg',data);
97 }
98 catch(error){
163async function getARoom (sendby,sendto) {
164 try{
165 let room = sendby+sendto+"Room";
166 let result = await userController.add_rooms(sendby,sendto,room);167 return room;
168 }
169 catch(error){
40 socket.emit('getusermsg',{'sendby' : name,'sendto' : sendto.value});
41});
42
43socket.on('signupsuccessful',(msg)=>{44 alert("SignedUp");
45})
46
87 feedback.innerHTML="<p><em>"+data.sendby + "is" + "typing"+"</em></p>";
88});
89
90socket.on('usernottyping',(data)=>{91 feedback.innerHTML="";
92});
120 const roomObj = {rooms : room};
121 User.updateMany({$or : [{name : sendby},{name : sendto}]},{$push : roomObj})
122 .exec()
123 .then(result=>{124 resolve("Ok");
125 })
126 .catch(error=>{
Found variables that are declared but not used anywhere.
NOTE: In browser applications, DeepSource recommends the use of ESModules over regular
text/javascript
scripts. Currently, we don't support variables that are not explicitly exported, and are injected into other scripts by being included in an HTML file
Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.
NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _
to prevent them from being flagged by DeepSource.
// Write-only variables are not considered as used.
let y = 10;
y = 5;
// A variable that modifies only itself isn't considered used.
let z = 0;
z = z + 1;
// Unused argument
(function(x) {
return 5;
})();
// Unused recursive functions also raise this issue.
function fact(n) {
if (n < 2) return 1;
return n * fact(n - 1);
}
// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
return y;
}
let x = 10;
alert(x);
((arg1) => {
return arg1;
})();
let myFunc;
myFunc = (n) => {
// this is legal
if (n < 0) myFunc();
};
// this is also considered legal
console.log(declaredLater);
var declaredLater;
// Only the second argument from the descructured array is used.
function getY([, y]) {
return y;
}