chore(browser): format CDP helpers
This commit is contained in:
1 parent
c8c84bc419
commit
a248bea50f
2 files changed
+14
-13
No files matched your search
+11
-8
@@ -353,14 +353,17 @@ async function canOpenWebSocket(
|
||||
): Promise<boolean> {
|
||||
return await new Promise<boolean>((resolve) => {
|
||||
const ws = new WebSocket(wsUrl, { handshakeTimeout: timeoutMs });
|
||||
const timer = setTimeout(() => {
|
||||
try {
|
||||
ws.terminate();
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
resolve(false);
|
||||
}, Math.max(50, timeoutMs + 25));
|
||||
const timer = setTimeout(
|
||||
() => {
|
||||
try {
|
||||
ws.terminate();
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
resolve(false);
|
||||
},
|
||||
Math.max(50, timeoutMs + 25),
|
||||
);
|
||||
ws.once("open", () => {
|
||||
clearTimeout(timer);
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user