Skip to content

Commit c8c8d91

Browse files
committed
refactor: inline timeout var; saves 4 bytes
1 parent 8d0bcd6 commit c8c8d91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function (url, opts) {
44
opts = opts || {};
55

66
var ws, num=0, $={};
7-
var ms=opts.timeout || 1e3, max=opts.maxAttempts || Infinity;
7+
var max = opts.maxAttempts || Infinity;
88

99
$.open = function () {
1010
ws = new WebSocket(url, opts.protocols || []);
@@ -30,7 +30,7 @@ export default function (url, opts) {
3030
(num++ < max) ? setTimeout(_ => {
3131
(opts.onreconnect || noop)(e);
3232
$.open();
33-
}, ms) : (opts.onmaximum || noop)(e);
33+
}, opts.timeout || 1e3) : (opts.onmaximum || noop)(e);
3434
};
3535

3636
$.json = function (x) {

0 commit comments

Comments
 (0)