Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/api/src/transport/ws/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Ws extends JsonRpcBase {
}

if (this._reconnectTimeoutId) {
window.clearTimeout(this._reconnectTimeoutId);
clearTimeout(this._reconnectTimeoutId);
this._reconnectTimeoutId = null;
}

Expand Down Expand Up @@ -118,7 +118,7 @@ class Ws extends JsonRpcBase {
count: 0
};

window.setInterval(() => {
setInterval(() => {
const n = this._count - this._lastCount.count;
const t = (Date.now() - this._lastCount.timestamp) / 1000;
const s = Math.round(1000 * n / t) / 1000;
Expand All @@ -133,7 +133,9 @@ class Ws extends JsonRpcBase {
};
}, 5000);

window._parityWS = this;
if(typeof window !== 'undefined') {
window._parityWS = this;
}
}

this._connectPromise = new Promise((resolve, reject) => {
Expand Down Expand Up @@ -194,7 +196,7 @@ class Ws extends JsonRpcBase {
_onError (event) {
// Only print error if the WS is connected
// ie. don't print if error == closed
window.setTimeout(() => {
setTimeout(() => {
if (this._connected) {
console.error('ws:onError');

Expand Down