Fixed not defined error in eslint in socket.io.client.service.js
This commit is contained in:
parent
cecbcf3b90
commit
f4342f68a2
|
@ -9,29 +9,7 @@
|
||||||
Socket.$inject = ['$timeout', '$window'];
|
Socket.$inject = ['$timeout', '$window'];
|
||||||
|
|
||||||
function Socket($timeout, $window) {
|
function Socket($timeout, $window) {
|
||||||
var service = {
|
|
||||||
connect: connect,
|
|
||||||
emit: emit,
|
|
||||||
on: on,
|
|
||||||
removeListener: removeListener,
|
|
||||||
socket: null
|
|
||||||
};
|
|
||||||
|
|
||||||
var url = '';
|
|
||||||
console.log("$window.socketPort: "+$window.socketPort);
|
|
||||||
console.log("$window.socketUrl: "+$window.socketUrl);
|
|
||||||
if($window.socketUrl && $window.socketPort){
|
|
||||||
url = window.location.protocol + '//' + $window.socketUrl + ':' + $window.socketPort;
|
|
||||||
} else if ($window.socketUrl && !$window.socketPort){
|
|
||||||
url = window.location.protocol + '//' + $window.socketUrl;
|
|
||||||
} else if ($window.socketPort){
|
|
||||||
url = window.location.protocol + '//' + window.location.hostname + ':' + $window.socketPort;
|
|
||||||
} else {
|
|
||||||
url = window.location.protocol + '//' + window.location.hostname;
|
|
||||||
}
|
|
||||||
connect(url);
|
|
||||||
|
|
||||||
return service;
|
|
||||||
|
|
||||||
// Connect to Socket.io server
|
// Connect to Socket.io server
|
||||||
function connect(url) {
|
function connect(url) {
|
||||||
|
@ -62,5 +40,29 @@
|
||||||
service.socket.removeListener(eventName);
|
service.socket.removeListener(eventName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var service = {
|
||||||
|
connect: connect,
|
||||||
|
emit: emit,
|
||||||
|
on: on,
|
||||||
|
removeListener: removeListener,
|
||||||
|
socket: null
|
||||||
|
};
|
||||||
|
|
||||||
|
var url = '';
|
||||||
|
console.log("$window.socketPort: "+$window.socketPort);
|
||||||
|
console.log("$window.socketUrl: "+$window.socketUrl);
|
||||||
|
if($window.socketUrl && $window.socketPort){
|
||||||
|
url = window.location.protocol + '//' + $window.socketUrl + ':' + $window.socketPort;
|
||||||
|
} else if ($window.socketUrl && !$window.socketPort){
|
||||||
|
url = window.location.protocol + '//' + $window.socketUrl;
|
||||||
|
} else if ($window.socketPort){
|
||||||
|
url = window.location.protocol + '//' + window.location.hostname + ':' + $window.socketPort;
|
||||||
|
} else {
|
||||||
|
url = window.location.protocol + '//' + window.location.hostname;
|
||||||
|
}
|
||||||
|
connect(url);
|
||||||
|
|
||||||
|
return service;
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in a new issue