Code cleaning
This commit is contained in:
parent
57adc6b21c
commit
1bbd0866cb
@ -94,10 +94,11 @@ export class IoSocketController {
|
||||
x: user x position on map
|
||||
y: user y position on map
|
||||
*/
|
||||
socket.on(SockerIoEvent.JOIN_ROOM, (roomId: any) => {
|
||||
socket.on(SockerIoEvent.JOIN_ROOM, (roomId: any): void => {
|
||||
try {
|
||||
if (typeof(roomId) !== 'string') {
|
||||
return socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: 'Expected roomId as a string.'})
|
||||
socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: 'Expected roomId as a string.'});
|
||||
return;
|
||||
}
|
||||
|
||||
let Client = (socket as ExSocketInterface);
|
||||
@ -124,11 +125,12 @@ export class IoSocketController {
|
||||
}
|
||||
});
|
||||
|
||||
socket.on(SockerIoEvent.USER_POSITION, (message: any) => {
|
||||
socket.on(SockerIoEvent.USER_POSITION, (message: any): void => {
|
||||
try {
|
||||
let position = this.hydratePositionReceive(message);
|
||||
if (position instanceof Error) {
|
||||
return socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: position.message});
|
||||
socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: position.message});
|
||||
return;
|
||||
}
|
||||
|
||||
let Client = (socket as ExSocketInterface);
|
||||
|
@ -36,7 +36,7 @@
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
|
@ -49,18 +49,12 @@ export class SimplePeer implements SimplePeerInterface{
|
||||
});
|
||||
|
||||
//receive signal by gemer
|
||||
this.Connexion.disconnectMessage((message: any) => {
|
||||
let data = message;
|
||||
this.Connexion.disconnectMessage((data: any) => {
|
||||
this.closeConnexion(data.userId);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
private receiveWebrtcStart(message: any) {
|
||||
let data = message;
|
||||
private receiveWebrtcStart(data: any) {
|
||||
this.WebRtcRoomId = data.roomId;
|
||||
this.Users = data.clients;
|
||||
|
||||
@ -193,12 +187,7 @@ export class SimplePeer implements SimplePeerInterface{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
private receiveWebrtcSignal(message: any) {
|
||||
let data = message;
|
||||
private receiveWebrtcSignal(data: any) {
|
||||
try {
|
||||
//if offer type, create peer connexion
|
||||
if(data.signal.type === "offer"){
|
||||
|
Loading…
Reference in New Issue
Block a user