mqtt 5.7.3 → 5.8.0
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/README.md +8 -1
- package/build/lib/KeepaliveManager.d.ts +2 -1
- package/build/lib/KeepaliveManager.js +6 -1
- package/build/lib/KeepaliveManager.js.map +1 -1
- package/build/lib/client.d.ts +2 -1
- package/build/lib/client.js.map +1 -1
- package/build/lib/is-browser.js +5 -1
- package/build/lib/is-browser.js.map +1 -1
- package/build/mqtt.d.ts +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +4 -3
- package/dist/mqtt.min.js +5 -5
- package/package.json +1 -1
- package/src/lib/KeepaliveManager.ts +7 -2
- package/src/lib/client.ts +3 -1
- package/src/lib/is-browser.ts +7 -1
- package/src/mqtt.ts +1 -0
package/package.json
CHANGED
|
@@ -33,9 +33,14 @@ export default class KeepaliveManager {
|
|
|
33
33
|
return this._keepalive
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
constructor(client: MqttClient, variant: TimerVariant) {
|
|
36
|
+
constructor(client: MqttClient, variant: TimerVariant | Timer) {
|
|
37
37
|
this.client = client
|
|
38
|
-
this.timer =
|
|
38
|
+
this.timer =
|
|
39
|
+
typeof variant === 'object' &&
|
|
40
|
+
'set' in variant &&
|
|
41
|
+
'clear' in variant
|
|
42
|
+
? variant
|
|
43
|
+
: getTimer(variant)
|
|
39
44
|
this.setKeepalive(client.options.keepalive)
|
|
40
45
|
}
|
|
41
46
|
|
package/src/lib/client.ts
CHANGED
|
@@ -41,6 +41,7 @@ import TopicAliasSend from './topic-alias-send'
|
|
|
41
41
|
import { TypedEventEmitter } from './TypedEmitter'
|
|
42
42
|
import KeepaliveManager from './KeepaliveManager'
|
|
43
43
|
import isBrowser, { isWebWorker } from './is-browser'
|
|
44
|
+
import { Timer } from './get-timer'
|
|
44
45
|
|
|
45
46
|
const setImmediate =
|
|
46
47
|
globalThis.setImmediate ||
|
|
@@ -278,8 +279,9 @@ export interface IClientOptions extends ISecureClientOptions {
|
|
|
278
279
|
properties?: IConnectPacket['properties']
|
|
279
280
|
/**
|
|
280
281
|
* @description 'auto', set to 'native' or 'worker' if you're having issues with 'auto' detection
|
|
282
|
+
* or pass a custom timer object
|
|
281
283
|
*/
|
|
282
|
-
timerVariant?: TimerVariant
|
|
284
|
+
timerVariant?: TimerVariant | Timer
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
export interface IClientPublishOptions {
|
package/src/lib/is-browser.ts
CHANGED
|
@@ -25,6 +25,9 @@ const isStandardBrowserEnv = () => {
|
|
|
25
25
|
return false
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
const isTxikijsEnv = () =>
|
|
29
|
+
typeof navigator !== 'undefined' && navigator.userAgent === 'txiki.js'
|
|
30
|
+
|
|
28
31
|
const isWebWorkerEnv = () =>
|
|
29
32
|
Boolean(
|
|
30
33
|
// eslint-disable-next-line no-restricted-globals
|
|
@@ -37,7 +40,10 @@ const isReactNativeEnv = () =>
|
|
|
37
40
|
typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
|
38
41
|
|
|
39
42
|
const isBrowser =
|
|
40
|
-
isStandardBrowserEnv() ||
|
|
43
|
+
isStandardBrowserEnv() ||
|
|
44
|
+
isWebWorkerEnv() ||
|
|
45
|
+
isReactNativeEnv() ||
|
|
46
|
+
isTxikijsEnv()
|
|
41
47
|
|
|
42
48
|
export const isWebWorker = isWebWorkerEnv()
|
|
43
49
|
|
package/src/mqtt.ts
CHANGED