Fixed not defined error in eslint in socket.io.client.service.js

This commit is contained in:
David Baldwynn 2017-04-20 21:26:51 -07:00 committed by GitHub
parent cecbcf3b90
commit f4342f68a2

View file

@ -9,29 +9,7 @@
Socket.$inject = ['$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
function connect(url) {
@ -62,5 +40,29 @@
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;
}
}());