@wordpress/priority-queue
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -30,2 +30,8 @@ /** | ||
/** | ||
* Reset the queue. | ||
* | ||
* @typedef {()=>void} WPPriorityQueueReset | ||
*/ | ||
/** | ||
* Priority queue instance. | ||
@@ -37,2 +43,3 @@ * | ||
* @property {WPPriorityQueueFlush} flush Flush queue for context. | ||
* @property {WPPriorityQueueReset} reset Reset queue. | ||
*/ | ||
@@ -60,3 +67,3 @@ | ||
* | ||
* @return {WPPriorityQueue} Queue object with `add` and `flush` methods. | ||
* @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods. | ||
*/ | ||
@@ -71,7 +78,7 @@ | ||
var isRunning = false; | ||
/* eslint-disable jsdoc/valid-types */ | ||
/** | ||
* Callback to process as much queue as time permits. | ||
* | ||
* @type {IdleRequestCallback & FrameRequestCallback} | ||
* | ||
* @param {IdleDeadline|number} deadline Idle callback deadline object, or | ||
@@ -81,2 +88,4 @@ * animation frame timestamp. | ||
/* eslint-enable */ | ||
var runWaitingList = function runWaitingList(deadline) { | ||
@@ -155,8 +164,21 @@ var hasTimeRemaining = typeof deadline === 'number' ? function () { | ||
}; | ||
/** | ||
* Reset the queue without running the pending callbacks. | ||
* | ||
* @type {WPPriorityQueueReset} | ||
*/ | ||
var reset = function reset() { | ||
waitingList = []; | ||
elementsMap = new WeakMap(); | ||
isRunning = false; | ||
}; | ||
return { | ||
add: add, | ||
flush: flush | ||
flush: flush, | ||
reset: reset | ||
}; | ||
}; | ||
//# sourceMappingURL=index.js.map |
/** | ||
* @return {typeof window.requestIdleCallback|typeof window.requestAnimationFrame|((callback:(timestamp:number)=>void)=>void)} | ||
* @typedef {( timeOrDeadline: IdleDeadline | number ) => void} Callback | ||
*/ | ||
/** | ||
* @return {(callback: Callback) => void} RequestIdleCallback | ||
*/ | ||
export function createRequestIdleCallback() { | ||
@@ -5,0 +9,0 @@ if (typeof window === 'undefined') { |
@@ -41,2 +41,8 @@ "use strict"; | ||
/** | ||
* Reset the queue. | ||
* | ||
* @typedef {()=>void} WPPriorityQueueReset | ||
*/ | ||
/** | ||
* Priority queue instance. | ||
@@ -48,2 +54,3 @@ * | ||
* @property {WPPriorityQueueFlush} flush Flush queue for context. | ||
* @property {WPPriorityQueueReset} reset Reset queue. | ||
*/ | ||
@@ -71,3 +78,3 @@ | ||
* | ||
* @return {WPPriorityQueue} Queue object with `add` and `flush` methods. | ||
* @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods. | ||
*/ | ||
@@ -81,7 +88,7 @@ var createQueue = function createQueue() { | ||
var isRunning = false; | ||
/* eslint-disable jsdoc/valid-types */ | ||
/** | ||
* Callback to process as much queue as time permits. | ||
* | ||
* @type {IdleRequestCallback & FrameRequestCallback} | ||
* | ||
* @param {IdleDeadline|number} deadline Idle callback deadline object, or | ||
@@ -91,2 +98,4 @@ * animation frame timestamp. | ||
/* eslint-enable */ | ||
var runWaitingList = function runWaitingList(deadline) { | ||
@@ -165,6 +174,19 @@ var hasTimeRemaining = typeof deadline === 'number' ? function () { | ||
}; | ||
/** | ||
* Reset the queue without running the pending callbacks. | ||
* | ||
* @type {WPPriorityQueueReset} | ||
*/ | ||
var reset = function reset() { | ||
waitingList = []; | ||
elementsMap = new WeakMap(); | ||
isRunning = false; | ||
}; | ||
return { | ||
add: add, | ||
flush: flush | ||
flush: flush, | ||
reset: reset | ||
}; | ||
@@ -171,0 +193,0 @@ }; |
@@ -10,4 +10,8 @@ "use strict"; | ||
/** | ||
* @return {typeof window.requestIdleCallback|typeof window.requestAnimationFrame|((callback:(timestamp:number)=>void)=>void)} | ||
* @typedef {( timeOrDeadline: IdleDeadline | number ) => void} Callback | ||
*/ | ||
/** | ||
* @return {(callback: Callback) => void} RequestIdleCallback | ||
*/ | ||
function createRequestIdleCallback() { | ||
@@ -14,0 +18,0 @@ if (typeof window === 'undefined') { |
## Master | ||
## 1.6.0 (2020-04-15) | ||
### New feature | ||
- Include TypeScript type declarations ([#18942](https://github.com/WordPress/gutenberg/pull/18942)) | ||
## 1.5.0 (2020-02-04) | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@wordpress/priority-queue", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "Generic browser priority queue.", | ||
@@ -24,5 +24,6 @@ "author": "The WordPress Contributors", | ||
"react-native": "src/index", | ||
"types": "build-types", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@babel/runtime": "^7.8.3" | ||
"@babel/runtime": "^7.9.2" | ||
}, | ||
@@ -32,3 +33,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "1d1b55f9ddaec0d368b1b87a37a5714d7ef02352" | ||
"gitHead": "65dbf3a9503402ca3837090dc89d0207f7d96352" | ||
} |
@@ -43,3 +43,3 @@ # Priority Queue | ||
- `WPPriorityQueue`: Queue object with `add` and `flush` methods. | ||
- `WPPriorityQueue`: Queue object with `add`, `flush` and `reset` methods. | ||
@@ -46,0 +46,0 @@ |
@@ -31,2 +31,8 @@ /** | ||
/** | ||
* Reset the queue. | ||
* | ||
* @typedef {()=>void} WPPriorityQueueReset | ||
*/ | ||
/** | ||
* Priority queue instance. | ||
@@ -38,2 +44,3 @@ * | ||
* @property {WPPriorityQueueFlush} flush Flush queue for context. | ||
* @property {WPPriorityQueueReset} reset Reset queue. | ||
*/ | ||
@@ -61,21 +68,21 @@ | ||
* | ||
* @return {WPPriorityQueue} Queue object with `add` and `flush` methods. | ||
* @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods. | ||
*/ | ||
export const createQueue = () => { | ||
/** @type {WPPriorityQueueContext[]} */ | ||
const waitingList = []; | ||
let waitingList = []; | ||
/** @type {WeakMap<WPPriorityQueueContext,WPPriorityQueueCallback>} */ | ||
const elementsMap = new WeakMap(); | ||
let elementsMap = new WeakMap(); | ||
let isRunning = false; | ||
/* eslint-disable jsdoc/valid-types */ | ||
/** | ||
* Callback to process as much queue as time permits. | ||
* | ||
* @type {IdleRequestCallback & FrameRequestCallback} | ||
* | ||
* @param {IdleDeadline|number} deadline Idle callback deadline object, or | ||
* animation frame timestamp. | ||
*/ | ||
/* eslint-enable */ | ||
const runWaitingList = ( deadline ) => { | ||
@@ -149,6 +156,18 @@ const hasTimeRemaining = | ||
/** | ||
* Reset the queue without running the pending callbacks. | ||
* | ||
* @type {WPPriorityQueueReset} | ||
*/ | ||
const reset = () => { | ||
waitingList = []; | ||
elementsMap = new WeakMap(); | ||
isRunning = false; | ||
}; | ||
return { | ||
add, | ||
flush, | ||
reset, | ||
}; | ||
}; |
/** | ||
* @return {typeof window.requestIdleCallback|typeof window.requestAnimationFrame|((callback:(timestamp:number)=>void)=>void)} | ||
* @typedef {( timeOrDeadline: IdleDeadline | number ) => void} Callback | ||
*/ | ||
/** | ||
* @return {(callback: Callback) => void} RequestIdleCallback | ||
*/ | ||
export function createRequestIdleCallback() { | ||
@@ -5,0 +9,0 @@ if ( typeof window === 'undefined' ) { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242797
21
683
Updated@babel/runtime@^7.9.2