mqtt 5.3.2 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/PingTimer.d.ts +2 -2
- package/build/lib/PingTimer.js +29 -7
- package/build/lib/PingTimer.js.map +1 -1
- package/build/lib/is-browser.d.ts +1 -0
- package/build/lib/is-browser.js +2 -0
- package/build/lib/is-browser.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +38 -7
- package/dist/mqtt.min.js +5 -5
- package/package.json +1 -1
- package/src/lib/PingTimer.ts +11 -5
- package/src/lib/is-browser.ts +2 -0
package/dist/mqtt.js
CHANGED
|
@@ -17512,6 +17512,7 @@ var mqtt = (() => {
|
|
|
17512
17512
|
init_buffer2();
|
|
17513
17513
|
init_process2();
|
|
17514
17514
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
17515
|
+
exports5.isWebWorker = void 0;
|
|
17515
17516
|
var isStandardBrowserEnv = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
17516
17517
|
var isWebWorkerEnv = () => {
|
|
17517
17518
|
var _a, _b;
|
|
@@ -17519,6 +17520,7 @@ var mqtt = (() => {
|
|
|
17519
17520
|
};
|
|
17520
17521
|
var isReactNativeEnv = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17521
17522
|
var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
|
|
17523
|
+
exports5.isWebWorker = isWebWorkerEnv();
|
|
17522
17524
|
exports5.default = isBrowser;
|
|
17523
17525
|
}
|
|
17524
17526
|
});
|
|
@@ -17530,29 +17532,58 @@ var mqtt = (() => {
|
|
|
17530
17532
|
init_dirname();
|
|
17531
17533
|
init_buffer2();
|
|
17532
17534
|
init_process2();
|
|
17533
|
-
var
|
|
17534
|
-
|
|
17535
|
+
var __createBinding = exports5 && exports5.__createBinding || (Object.create ? function(o7, m4, k2, k22) {
|
|
17536
|
+
if (k22 === void 0)
|
|
17537
|
+
k22 = k2;
|
|
17538
|
+
var desc = Object.getOwnPropertyDescriptor(m4, k2);
|
|
17539
|
+
if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) {
|
|
17540
|
+
desc = { enumerable: true, get: function() {
|
|
17541
|
+
return m4[k2];
|
|
17542
|
+
} };
|
|
17543
|
+
}
|
|
17544
|
+
Object.defineProperty(o7, k22, desc);
|
|
17545
|
+
} : function(o7, m4, k2, k22) {
|
|
17546
|
+
if (k22 === void 0)
|
|
17547
|
+
k22 = k2;
|
|
17548
|
+
o7[k22] = m4[k2];
|
|
17549
|
+
});
|
|
17550
|
+
var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? function(o7, v4) {
|
|
17551
|
+
Object.defineProperty(o7, "default", { enumerable: true, value: v4 });
|
|
17552
|
+
} : function(o7, v4) {
|
|
17553
|
+
o7["default"] = v4;
|
|
17554
|
+
});
|
|
17555
|
+
var __importStar = exports5 && exports5.__importStar || function(mod) {
|
|
17556
|
+
if (mod && mod.__esModule)
|
|
17557
|
+
return mod;
|
|
17558
|
+
var result = {};
|
|
17559
|
+
if (mod != null) {
|
|
17560
|
+
for (var k2 in mod)
|
|
17561
|
+
if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod, k2))
|
|
17562
|
+
__createBinding(result, mod, k2);
|
|
17563
|
+
}
|
|
17564
|
+
__setModuleDefault(result, mod);
|
|
17565
|
+
return result;
|
|
17535
17566
|
};
|
|
17536
17567
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
17537
17568
|
var worker_timers_1 = require_bundle3();
|
|
17538
|
-
var is_browser_1 =
|
|
17569
|
+
var is_browser_1 = __importStar(require_is_browser());
|
|
17539
17570
|
var PingTimer = class {
|
|
17540
17571
|
constructor(keepalive, checkPing) {
|
|
17541
|
-
this.
|
|
17542
|
-
this.
|
|
17572
|
+
this._setTimeout = is_browser_1.default && !is_browser_1.isWebWorker ? worker_timers_1.setTimeout : (func, time) => setTimeout(func, time);
|
|
17573
|
+
this._clearTimeout = is_browser_1.default && !is_browser_1.isWebWorker ? worker_timers_1.clearTimeout : (timer) => clearTimeout(timer);
|
|
17543
17574
|
this.keepalive = keepalive * 1e3;
|
|
17544
17575
|
this.checkPing = checkPing;
|
|
17545
17576
|
this.setup();
|
|
17546
17577
|
}
|
|
17547
17578
|
setup() {
|
|
17548
|
-
this.timer = this.
|
|
17579
|
+
this.timer = this._setTimeout(() => {
|
|
17549
17580
|
this.checkPing();
|
|
17550
17581
|
this.reschedule();
|
|
17551
17582
|
}, this.keepalive);
|
|
17552
17583
|
}
|
|
17553
17584
|
clear() {
|
|
17554
17585
|
if (this.timer) {
|
|
17555
|
-
this.
|
|
17586
|
+
this._clearTimeout(this.timer);
|
|
17556
17587
|
this.timer = null;
|
|
17557
17588
|
}
|
|
17558
17589
|
}
|