New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

message-bus-client

Package Overview
Dependencies
Maintainers
7
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

message-bus-client - npm Package Compare versions

Comparing version 4.3.0 to 4.3.1

59

assets/message-bus.js

@@ -43,3 +43,3 @@ /*global define, jQuery*/

var totalAjaxCalls = 0;
var lastAjax;
var lastAjaxStartedAt;

@@ -160,7 +160,7 @@ var isHidden = (function () {

var gotData = false;
var aborted = false;
var abortedByClient = false;
var rateLimited = false;
var rateLimitedSeconds;
lastAjax = new Date();
lastAjaxStartedAt = new Date();
totalAjaxCalls += 1;

@@ -286,3 +286,3 @@ data.__seq = totalAjaxCalls;

} else if (textStatus === "abort") {
aborted = true;
abortedByClient = true;
} else {

@@ -296,23 +296,36 @@ failCount += 1;

var interval;
var inLongPollingMode = shouldLongPoll();
var startNextRequestAfter;
try {
if (rateLimited) {
interval = Math.max(me.minPollInterval, rateLimitedSeconds * 1000);
} else if (gotData || aborted) {
interval = me.minPollInterval;
// Respect `Retry-After` header
startNextRequestAfter = Math.max(
me.minPollInterval,
rateLimitedSeconds * 1000
);
} else if (abortedByClient) {
// Immediately trigger another poll
startNextRequestAfter = me.minPollInterval;
} else if (failCount > 2) {
// Linear backoff up to maxPollInterval
startNextRequestAfter = Math.min(
me.callbackInterval * failCount,
me.maxPollInterval
);
} else if (inLongPollingMode && gotData) {
// Immediately trigger another poll
startNextRequestAfter = me.minPollInterval;
} else {
interval = me.callbackInterval;
if (failCount > 2) {
interval = interval * failCount;
} else if (!shouldLongPoll()) {
interval = me.backgroundCallbackInterval;
}
if (interval > me.maxPollInterval) {
interval = me.maxPollInterval;
}
// Trigger next poll N seconds after the last one **started**
var targetRequestInterval = inLongPollingMode
? me.callbackInterval
: me.backgroundCallbackInterval;
interval -= new Date() - lastAjax;
var elapsedSinceLastAjaxStarted = new Date() - lastAjaxStartedAt;
if (interval < 100) {
interval = 100;
startNextRequestAfter =
targetRequestInterval - elapsedSinceLastAjaxStarted;
if (startNextRequestAfter < 100) {
startNextRequestAfter = 100;
}

@@ -335,3 +348,3 @@ }

poll();
}, interval);
}, startNextRequestAfter);
}

@@ -375,3 +388,5 @@

console.log(
"Last ajax call: " + (new Date() - lastAjax) / 1000 + " seconds ago"
"Last ajax call: " +
(new Date() - lastAjaxStartedAt) / 1000 +
" seconds ago"
);

@@ -378,0 +393,0 @@ },

{
"name": "message-bus-client",
"version": "4.3.0",
"version": "4.3.1",
"description": "A message bus client in Javascript",

@@ -23,3 +23,3 @@ "main": "assets/message-bus.js",

"devDependencies": {
"eslint": "^7.27.0",
"eslint": "^8.31.0",
"jasmine-browser-runner": "^0.10.0",

@@ -26,0 +26,0 @@ "jasmine-core": "^3.10.1"

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