mqtt 5.3.0 → 5.3.1
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/is-browser.js +8 -5
- package/build/lib/is-browser.js.map +1 -1
- package/build/lib/shared.d.ts +1 -1
- package/build/lib/shared.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +7 -1
- package/dist/mqtt.min.js +5 -5
- package/package.json +1 -1
- package/src/lib/is-browser.ts +15 -8
- package/src/lib/shared.ts +2 -1
package/package.json
CHANGED
package/src/lib/is-browser.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
self.constructor &&
|
|
1
|
+
const isStandardBrowserEnv = () =>
|
|
2
|
+
typeof window !== 'undefined' && typeof window.document !== 'undefined'
|
|
3
|
+
|
|
4
|
+
const isWebWorkerEnv = () =>
|
|
5
|
+
Boolean(
|
|
7
6
|
// eslint-disable-next-line no-restricted-globals
|
|
8
|
-
self
|
|
9
|
-
|
|
7
|
+
typeof self === 'object' &&
|
|
8
|
+
// eslint-disable-next-line no-restricted-globals
|
|
9
|
+
self?.constructor?.name?.includes('WorkerGlobalScope'),
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
const isReactNativeEnv = () =>
|
|
13
|
+
typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
|
14
|
+
|
|
15
|
+
const isBrowser =
|
|
16
|
+
isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv()
|
|
10
17
|
|
|
11
18
|
export default isBrowser
|
package/src/lib/shared.ts
CHANGED
|
@@ -10,7 +10,8 @@ export type GenericCallback<T> = (error?: Error, result?: T) => void
|
|
|
10
10
|
export type VoidCallback = () => void
|
|
11
11
|
|
|
12
12
|
export type IStream = Duplex & {
|
|
13
|
-
|
|
13
|
+
/** only set on browsers, it's a [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) */
|
|
14
|
+
socket?: any
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export type StreamBuilder = (
|