Comparing version 1.4.1 to 1.4.2
40
index.js
@@ -11,21 +11,35 @@ // @ts-ignore | ||
function connectSocket(url) { | ||
socket = io(url); | ||
// function connectSocket(url) { | ||
// socket = io(url); | ||
let currentRoute = null; | ||
// let currentRoute = null; | ||
if (typeof window !== "undefined") { | ||
currentRoute = window.location.pathname; | ||
} | ||
// if (typeof window !== "undefined") { | ||
// currentRoute = window.location.pathname; | ||
// } | ||
let IsConnected = false; | ||
// let IsConnected = false; | ||
socket.on("connect", () => { | ||
socketId = socket.id; | ||
IsConnected = true; | ||
// socket.on("connect", () => { | ||
// socketId = socket.id; | ||
// IsConnected = true; | ||
// }); | ||
// return IsConnected === true ? "Socket Connected!" : "Socket not connected!"; | ||
// } | ||
const connectSocket = (url) => { | ||
return new Promise((resolve, reject) => { | ||
socket = io(url); | ||
socket.on("connect", () => { | ||
resolve(socket.id); | ||
}); | ||
socket.on("connect_error", (error) => { | ||
reject(error); | ||
}); | ||
}); | ||
}; | ||
return IsConnected === true ? "Socket Connected!" : "Socket not connected!"; | ||
} | ||
// function to disconnect the socket | ||
@@ -32,0 +46,0 @@ function disconnectSocket(url) { |
@@ -7,3 +7,3 @@ { | ||
"name": "sockettwo", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"main": "index.js", | ||
@@ -10,0 +10,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4736
146