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

@wordpress/priority-queue

Package Overview
Dependencies
Maintainers
25
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/priority-queue - npm Package Compare versions

Comparing version 2.39.0 to 2.40.0

23

build-module/index.js

@@ -5,2 +5,3 @@ /**

import requestIdleCallback from './request-idle-callback';
/**

@@ -69,3 +70,2 @@ * Enqueued callback to invoke once idle time permits.

*/
export const createQueue = () => {

@@ -75,2 +75,3 @@ /** @type {Map<WPPriorityQueueContext, WPPriorityQueueCallback>} */

let isRunning = false;
/**

@@ -92,3 +93,2 @@ * Callback to process as much queue as time permits.

*/
const runWaitingList = deadline => {

@@ -98,3 +98,2 @@ for (const [nextElement, callback] of waitingList) {

callback();
if ('number' === typeof deadline || deadline.timeRemaining() <= 0) {

@@ -104,3 +103,2 @@ break;

}
if (waitingList.size === 0) {

@@ -110,5 +108,5 @@ isRunning = false;

}
requestIdleCallback(runWaitingList);
};
/**

@@ -127,7 +125,4 @@ * Add a callback to the queue for a given context.

*/
const add = (element, item) => {
waitingList.set(element, item);
if (!isRunning) {

@@ -138,2 +133,3 @@ isRunning = true;

};
/**

@@ -149,11 +145,7 @@ * Flushes queue for a given context, returning true if the flush was

*/
const flush = element => {
const callback = waitingList.get(element);
if (undefined === callback) {
return false;
}
waitingList.delete(element);

@@ -163,2 +155,3 @@ callback();

};
/**

@@ -175,7 +168,6 @@ * Clears the queue for a given context, cancelling the callbacks without

*/
const cancel = element => {
return waitingList.delete(element);
};
/**

@@ -186,4 +178,2 @@ * Reset the queue without running the pending callbacks.

*/
const reset = () => {

@@ -193,3 +183,2 @@ waitingList.clear();

};
return {

@@ -196,0 +185,0 @@ add,

@@ -5,2 +5,3 @@ /**

import 'requestidlecallback';
/**

@@ -13,3 +14,2 @@ * @typedef {( timeOrDeadline: IdleDeadline | number ) => void} Callback

*/
export function createRequestIdleCallback() {

@@ -21,3 +21,2 @@ if (typeof window === 'undefined') {

}
return window.requestIdleCallback;

@@ -24,0 +23,0 @@ }

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,5 +8,3 @@ value: true

exports.createQueue = void 0;
var _requestIdleCallback = _interopRequireDefault(require("./request-idle-callback"));
/**

@@ -84,2 +81,3 @@ * Internal dependencies

let isRunning = false;
/**

@@ -101,3 +99,2 @@ * Callback to process as much queue as time permits.

*/
const runWaitingList = deadline => {

@@ -107,3 +104,2 @@ for (const [nextElement, callback] of waitingList) {

callback();
if ('number' === typeof deadline || deadline.timeRemaining() <= 0) {

@@ -113,3 +109,2 @@ break;

}
if (waitingList.size === 0) {

@@ -119,5 +114,5 @@ isRunning = false;

}
(0, _requestIdleCallback.default)(runWaitingList);
};
/**

@@ -136,7 +131,4 @@ * Add a callback to the queue for a given context.

*/
const add = (element, item) => {
waitingList.set(element, item);
if (!isRunning) {

@@ -147,2 +139,3 @@ isRunning = true;

};
/**

@@ -158,11 +151,7 @@ * Flushes queue for a given context, returning true if the flush was

*/
const flush = element => {
const callback = waitingList.get(element);
if (undefined === callback) {
return false;
}
waitingList.delete(element);

@@ -172,2 +161,3 @@ callback();

};
/**

@@ -184,7 +174,6 @@ * Clears the queue for a given context, cancelling the callbacks without

*/
const cancel = element => {
return waitingList.delete(element);
};
/**

@@ -195,4 +184,2 @@ * Reset the queue without running the pending callbacks.

*/
const reset = () => {

@@ -202,3 +189,2 @@ waitingList.clear();

};
return {

@@ -211,4 +197,3 @@ add,

};
exports.createQueue = createQueue;
//# sourceMappingURL=index.js.map

@@ -8,5 +8,3 @@ "use strict";

exports.default = void 0;
require("requestidlecallback");
/**

@@ -29,9 +27,6 @@ * External dependencies

}
return window.requestIdleCallback;
}
var _default = createRequestIdleCallback();
exports.default = _default;
//# sourceMappingURL=request-idle-callback.js.map

@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 2.40.0 (2023-08-16)
## 2.39.0 (2023-08-10)

@@ -7,0 +9,0 @@

{
"name": "@wordpress/priority-queue",
"version": "2.39.0",
"version": "2.40.0",
"description": "Generic browser priority queue.",

@@ -37,3 +37,3 @@ "author": "The WordPress Contributors",

},
"gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
"gitHead": "78a288d55b83a713b2f7d98d5a855c0771a2afc6"
}

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 not supported yet

Sorry, the diff of this file is not supported yet

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