Socket
Socket
Sign inDemoInstall

mqtt

Package Overview
Dependencies
Maintainers
7
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqtt - npm Package Compare versions

Comparing version 5.3.2 to 5.3.3

1

build/lib/is-browser.d.ts
declare const isBrowser: boolean;
export declare const isWebWorker: boolean;
export default isBrowser;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWebWorker = void 0;
const isStandardBrowserEnv = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';

@@ -11,3 +12,4 @@ const isWebWorkerEnv = () => {

const isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
exports.isWebWorker = isWebWorkerEnv();
exports.default = isBrowser;
//# sourceMappingURL=is-browser.js.map

4

build/lib/PingTimer.d.ts

@@ -5,4 +5,4 @@ export default class PingTimer {

private checkPing;
private setTimeout;
private clearTimeout;
private _setTimeout;
private _clearTimeout;
constructor(keepalive: number, checkPing: () => void);

@@ -9,0 +9,0 @@ private setup;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const worker_timers_1 = require("worker-timers");
const is_browser_1 = __importDefault(require("./is-browser"));
const is_browser_1 = __importStar(require("./is-browser"));
class PingTimer {
constructor(keepalive, checkPing) {
this.setTimeout = is_browser_1.default ? worker_timers_1.setTimeout : setTimeout;
this.clearTimeout = is_browser_1.default ? worker_timers_1.clearTimeout : clearTimeout;
this._setTimeout = is_browser_1.default && !is_browser_1.isWebWorker
? worker_timers_1.setTimeout
: (func, time) => setTimeout(func, time);
this._clearTimeout = is_browser_1.default && !is_browser_1.isWebWorker ? worker_timers_1.clearTimeout : (timer) => clearTimeout(timer);
this.keepalive = keepalive * 1000;

@@ -17,3 +39,3 @@ this.checkPing = checkPing;

setup() {
this.timer = this.setTimeout(() => {
this.timer = this._setTimeout(() => {
this.checkPing();

@@ -25,3 +47,3 @@ this.reschedule();

if (this.timer) {
this.clearTimeout(this.timer);
this._clearTimeout(this.timer);
this.timer = null;

@@ -28,0 +50,0 @@ }

{
"name": "mqtt",
"description": "A library for the MQTT protocol",
"version": "5.3.2",
"version": "5.3.3",
"contributors": [

@@ -6,0 +6,0 @@ "Adam Rudd <adamvrr@gmail.com>",

@@ -18,2 +18,4 @@ const isStandardBrowserEnv = () =>

export const isWebWorker = isWebWorkerEnv()
export default isBrowser
import { clearTimeout as clearT, setTimeout as setT } from 'worker-timers'
import isBrowser from './is-browser'
import isBrowser, { isWebWorker } from './is-browser'

@@ -11,5 +11,11 @@ export default class PingTimer {

private setTimeout = isBrowser ? setT : setTimeout
// dont directly assign globals to class props otherwise this throws in web workers: Uncaught TypeError: Illegal invocation
// See: https://stackoverflow.com/questions/9677985/uncaught-typeerror-illegal-invocation-in-chrome
private _setTimeout: typeof setT =
isBrowser && !isWebWorker
? setT
: (func, time) => setTimeout(func, time)
private clearTimeout = isBrowser ? clearT : clearTimeout
private _clearTimeout: typeof clearT =
isBrowser && !isWebWorker ? clearT : (timer) => clearTimeout(timer)

@@ -23,3 +29,3 @@ constructor(keepalive: number, checkPing: () => void) {

private setup() {
this.timer = this.setTimeout(() => {
this.timer = this._setTimeout(() => {
this.checkPing()

@@ -32,3 +38,3 @@ this.reschedule()

if (this.timer) {
this.clearTimeout(this.timer)
this._clearTimeout(this.timer)
this.timer = null

@@ -35,0 +41,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc