@wordpress/priority-queue 3.26.1-next.719a03cbe.0 → 3.27.1-next.46f643fa0.0
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/CHANGELOG.md +2 -0
- package/build/index.js +1 -39
- package/build/index.js.map +1 -1
- package/build/request-idle-callback.js +2 -2
- package/build/request-idle-callback.js.map +1 -1
- package/build/types.js +6 -0
- package/build/types.js.map +1 -0
- package/build-module/index.js +1 -39
- package/build-module/index.js.map +1 -1
- package/build-module/request-idle-callback.js +2 -2
- package/build-module/request-idle-callback.js.map +1 -1
- package/build-module/types.js +2 -0
- package/build-module/types.js.map +1 -0
- package/build-types/index.d.ts +38 -26
- package/build-types/index.d.ts.map +1 -1
- package/build-types/request-idle-callback.d.ts +15 -5
- package/build-types/request-idle-callback.d.ts.map +1 -1
- package/build-types/types.d.ts +6 -0
- package/build-types/types.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/{index.js → index.ts} +43 -43
- package/src/{request-idle-callback.js → request-idle-callback.ts} +4 -3
- package/src/test/{index.js → index.ts} +7 -2
- package/src/types.ts +6 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
package/build/index.js
CHANGED
|
@@ -12,43 +12,14 @@ var _requestIdleCallback = _interopRequireDefault(require("./request-idle-callba
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Enqueued callback to invoke once idle time permits.
|
|
15
|
-
*
|
|
16
|
-
* @typedef {()=>void} WPPriorityQueueCallback
|
|
17
15
|
*/
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* An object used to associate callbacks in a particular context grouping.
|
|
21
|
-
*
|
|
22
|
-
* @typedef {{}} WPPriorityQueueContext
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Function to add callback to priority queue.
|
|
27
|
-
*
|
|
28
|
-
* @typedef {(element:WPPriorityQueueContext,item:WPPriorityQueueCallback)=>void} WPPriorityQueueAdd
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Function to flush callbacks from priority queue.
|
|
33
|
-
*
|
|
34
|
-
* @typedef {(element:WPPriorityQueueContext)=>boolean} WPPriorityQueueFlush
|
|
35
19
|
*/
|
|
36
20
|
|
|
37
21
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @typedef {()=>void} WPPriorityQueueReset
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Priority queue instance.
|
|
45
|
-
*
|
|
46
|
-
* @typedef {Object} WPPriorityQueue
|
|
47
|
-
*
|
|
48
|
-
* @property {WPPriorityQueueAdd} add Add callback to queue for context.
|
|
49
|
-
* @property {WPPriorityQueueFlush} flush Flush queue for context.
|
|
50
|
-
* @property {WPPriorityQueueFlush} cancel Clear queue for context.
|
|
51
|
-
* @property {WPPriorityQueueReset} reset Reset queue.
|
|
22
|
+
* Interface for the priority queue instance.
|
|
52
23
|
*/
|
|
53
24
|
|
|
54
25
|
/**
|
|
@@ -74,7 +45,6 @@ var _requestIdleCallback = _interopRequireDefault(require("./request-idle-callba
|
|
|
74
45
|
* @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods.
|
|
75
46
|
*/
|
|
76
47
|
const createQueue = () => {
|
|
77
|
-
/** @type {Map<WPPriorityQueueContext, WPPriorityQueueCallback>} */
|
|
78
48
|
const waitingList = new Map();
|
|
79
49
|
let isRunning = false;
|
|
80
50
|
|
|
@@ -117,8 +87,6 @@ const createQueue = () => {
|
|
|
117
87
|
* in their second parameter. Missing dependencies can cause unexpected
|
|
118
88
|
* loops and race conditions in the queue.
|
|
119
89
|
*
|
|
120
|
-
* @type {WPPriorityQueueAdd}
|
|
121
|
-
*
|
|
122
90
|
* @param {WPPriorityQueueContext} element Context object.
|
|
123
91
|
* @param {WPPriorityQueueCallback} item Callback function.
|
|
124
92
|
*/
|
|
@@ -134,8 +102,6 @@ const createQueue = () => {
|
|
|
134
102
|
* Flushes queue for a given context, returning true if the flush was
|
|
135
103
|
* performed, or false if there is no queue for the given context.
|
|
136
104
|
*
|
|
137
|
-
* @type {WPPriorityQueueFlush}
|
|
138
|
-
*
|
|
139
105
|
* @param {WPPriorityQueueContext} element Context object.
|
|
140
106
|
*
|
|
141
107
|
* @return {boolean} Whether flush was performed.
|
|
@@ -155,8 +121,6 @@ const createQueue = () => {
|
|
|
155
121
|
* executing them. Returns `true` if there were scheduled callbacks to cancel,
|
|
156
122
|
* or `false` if there was is no queue for the given context.
|
|
157
123
|
*
|
|
158
|
-
* @type {WPPriorityQueueFlush}
|
|
159
|
-
*
|
|
160
124
|
* @param {WPPriorityQueueContext} element Context object.
|
|
161
125
|
*
|
|
162
126
|
* @return {boolean} Whether any callbacks got cancelled.
|
|
@@ -167,8 +131,6 @@ const createQueue = () => {
|
|
|
167
131
|
|
|
168
132
|
/**
|
|
169
133
|
* Reset the queue without running the pending callbacks.
|
|
170
|
-
*
|
|
171
|
-
* @type {WPPriorityQueueReset}
|
|
172
134
|
*/
|
|
173
135
|
const reset = () => {
|
|
174
136
|
waitingList.clear();
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_requestIdleCallback","_interopRequireDefault","require","createQueue","waitingList","Map","isRunning","runWaitingList","deadline","nextElement","callback","delete","timeRemaining","size","requestIdleCallback","add","element","item","set","flush","get","undefined","cancel","reset","clear","exports"],"sources":["@wordpress/priority-queue/src/index.
|
|
1
|
+
{"version":3,"names":["_requestIdleCallback","_interopRequireDefault","require","createQueue","waitingList","Map","isRunning","runWaitingList","deadline","nextElement","callback","delete","timeRemaining","size","requestIdleCallback","add","element","item","set","flush","get","undefined","cancel","reset","clear","exports"],"sources":["@wordpress/priority-queue/src/index.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport requestIdleCallback from './request-idle-callback';\n\n/**\n * Enqueued callback to invoke once idle time permits.\n */\nexport type WPPriorityQueueCallback = VoidFunction;\n\n/**\n * An object used to associate callbacks in a particular context grouping.\n */\nexport type WPPriorityQueueContext = object;\n\n/**\n * Interface for the priority queue instance.\n */\nexport interface WPPriorityQueue {\n\t/**\n\t * Add a callback to the queue for a given context.\n\t */\n\tadd: (\n\t\telement: WPPriorityQueueContext,\n\t\titem: WPPriorityQueueCallback\n\t) => void;\n\n\t/**\n\t * Flush and run the callback for a given context immediately.\n\t * @return true if a callback was run, false otherwise.\n\t */\n\tflush: ( element: WPPriorityQueueContext ) => boolean;\n\n\t/**\n\t * Cancel (remove) the callback for a given context without running it.\n\t * @return true if a callback was cancelled, false otherwise.\n\t */\n\tcancel: ( element: WPPriorityQueueContext ) => boolean;\n\n\t/**\n\t * Reset the entire queue, clearing pending callbacks.\n\t */\n\treset: VoidFunction;\n}\n\n/**\n * Creates a context-aware queue that only executes\n * the last task of a given context.\n *\n * @example\n *```js\n * import { createQueue } from '@wordpress/priority-queue';\n *\n * const queue = createQueue();\n *\n * // Context objects.\n * const ctx1 = {};\n * const ctx2 = {};\n *\n * // For a given context in the queue, only the last callback is executed.\n * queue.add( ctx1, () => console.log( 'This will be printed first' ) );\n * queue.add( ctx2, () => console.log( 'This won\\'t be printed' ) );\n * queue.add( ctx2, () => console.log( 'This will be printed second' ) );\n *```\n *\n * @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods.\n */\nexport const createQueue = (): WPPriorityQueue => {\n\tconst waitingList = new Map<\n\t\tWPPriorityQueueContext,\n\t\tWPPriorityQueueCallback\n\t>();\n\tlet isRunning = false;\n\n\t/**\n\t * Callback to process as much queue as time permits.\n\t *\n\t * Map Iteration follows the original insertion order. This means that here\n\t * we can iterate the queue and know that the first contexts which were\n\t * added will be run first. On the other hand, if anyone adds a new callback\n\t * for an existing context it will supplant the previously-set callback for\n\t * that context because we reassigned that map key's value.\n\t *\n\t * In the case that a callback adds a new callback to its own context then\n\t * the callback it adds will appear at the end of the iteration and will be\n\t * run only after all other existing contexts have finished executing.\n\t *\n\t * @param {IdleDeadline|number} deadline Idle callback deadline object, or\n\t * animation frame timestamp.\n\t */\n\tconst runWaitingList = ( deadline: IdleDeadline | number ): void => {\n\t\tfor ( const [ nextElement, callback ] of waitingList ) {\n\t\t\twaitingList.delete( nextElement );\n\t\t\tcallback();\n\n\t\t\tif (\n\t\t\t\t'number' === typeof deadline ||\n\t\t\t\tdeadline.timeRemaining() <= 0\n\t\t\t) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( waitingList.size === 0 ) {\n\t\t\tisRunning = false;\n\t\t\treturn;\n\t\t}\n\n\t\trequestIdleCallback( runWaitingList );\n\t};\n\n\t/**\n\t * Add a callback to the queue for a given context.\n\t *\n\t * If errors with undefined callbacks are encountered double check that\n\t * all of your useSelect calls have the right dependencies set correctly\n\t * in their second parameter. Missing dependencies can cause unexpected\n\t * loops and race conditions in the queue.\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t * @param {WPPriorityQueueCallback} item Callback function.\n\t */\n\tconst add: WPPriorityQueue[ 'add' ] = (\n\t\telement: WPPriorityQueueContext,\n\t\titem: WPPriorityQueueCallback\n\t) => {\n\t\twaitingList.set( element, item );\n\t\tif ( ! isRunning ) {\n\t\t\tisRunning = true;\n\t\t\trequestIdleCallback( runWaitingList );\n\t\t}\n\t};\n\n\t/**\n\t * Flushes queue for a given context, returning true if the flush was\n\t * performed, or false if there is no queue for the given context.\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t *\n\t * @return {boolean} Whether flush was performed.\n\t */\n\tconst flush: WPPriorityQueue[ 'flush' ] = (\n\t\telement: WPPriorityQueueContext\n\t) => {\n\t\tconst callback = waitingList.get( element );\n\t\tif ( undefined === callback ) {\n\t\t\treturn false;\n\t\t}\n\n\t\twaitingList.delete( element );\n\t\tcallback();\n\n\t\treturn true;\n\t};\n\n\t/**\n\t * Clears the queue for a given context, cancelling the callbacks without\n\t * executing them. Returns `true` if there were scheduled callbacks to cancel,\n\t * or `false` if there was is no queue for the given context.\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t *\n\t * @return {boolean} Whether any callbacks got cancelled.\n\t */\n\tconst cancel: WPPriorityQueue[ 'cancel' ] = (\n\t\telement: WPPriorityQueueContext\n\t) => {\n\t\treturn waitingList.delete( element );\n\t};\n\n\t/**\n\t * Reset the queue without running the pending callbacks.\n\t */\n\tconst reset: WPPriorityQueue[ 'reset' ] = () => {\n\t\twaitingList.clear();\n\t\tisRunning = false;\n\t};\n\n\treturn {\n\t\tadd,\n\t\tflush,\n\t\tcancel,\n\t\treset,\n\t};\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAGA,CAAA,KAAuB;EACjD,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAGzB,CAAC;EACH,IAAIC,SAAS,GAAG,KAAK;;EAErB;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMC,cAAc,GAAKC,QAA+B,IAAY;IACnE,KAAM,MAAM,CAAEC,WAAW,EAAEC,QAAQ,CAAE,IAAIN,WAAW,EAAG;MACtDA,WAAW,CAACO,MAAM,CAAEF,WAAY,CAAC;MACjCC,QAAQ,CAAC,CAAC;MAEV,IACC,QAAQ,KAAK,OAAOF,QAAQ,IAC5BA,QAAQ,CAACI,aAAa,CAAC,CAAC,IAAI,CAAC,EAC5B;QACD;MACD;IACD;IAEA,IAAKR,WAAW,CAACS,IAAI,KAAK,CAAC,EAAG;MAC7BP,SAAS,GAAG,KAAK;MACjB;IACD;IAEA,IAAAQ,4BAAmB,EAAEP,cAAe,CAAC;EACtC,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMQ,GAA6B,GAAGA,CACrCC,OAA+B,EAC/BC,IAA6B,KACzB;IACJb,WAAW,CAACc,GAAG,CAAEF,OAAO,EAAEC,IAAK,CAAC;IAChC,IAAK,CAAEX,SAAS,EAAG;MAClBA,SAAS,GAAG,IAAI;MAChB,IAAAQ,4BAAmB,EAAEP,cAAe,CAAC;IACtC;EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMY,KAAiC,GACtCH,OAA+B,IAC3B;IACJ,MAAMN,QAAQ,GAAGN,WAAW,CAACgB,GAAG,CAAEJ,OAAQ,CAAC;IAC3C,IAAKK,SAAS,KAAKX,QAAQ,EAAG;MAC7B,OAAO,KAAK;IACb;IAEAN,WAAW,CAACO,MAAM,CAAEK,OAAQ,CAAC;IAC7BN,QAAQ,CAAC,CAAC;IAEV,OAAO,IAAI;EACZ,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMY,MAAmC,GACxCN,OAA+B,IAC3B;IACJ,OAAOZ,WAAW,CAACO,MAAM,CAAEK,OAAQ,CAAC;EACrC,CAAC;;EAED;AACD;AACA;EACC,MAAMO,KAAiC,GAAGA,CAAA,KAAM;IAC/CnB,WAAW,CAACoB,KAAK,CAAC,CAAC;IACnBlB,SAAS,GAAG,KAAK;EAClB,CAAC;EAED,OAAO;IACNS,GAAG;IACHI,KAAK;IACLG,MAAM;IACNC;EACD,CAAC;AACF,CAAC;AAACE,OAAA,CAAAtB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -11,11 +11,11 @@ require("requestidlecallback");
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @return
|
|
18
|
+
* @return A function that schedules a callback when the browser is idle or via setTimeout on the server.
|
|
19
19
|
*/
|
|
20
20
|
function createRequestIdleCallback() {
|
|
21
21
|
if (typeof window === 'undefined') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","createRequestIdleCallback","window","callback","setTimeout","Date","now","requestIdleCallback","_default","exports","default"],"sources":["@wordpress/priority-queue/src/request-idle-callback.
|
|
1
|
+
{"version":3,"names":["require","createRequestIdleCallback","window","callback","setTimeout","Date","now","requestIdleCallback","_default","exports","default"],"sources":["@wordpress/priority-queue/src/request-idle-callback.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport 'requestidlecallback';\n\n/**\n * Internal dependencies\n */\nimport type { RequestIdleCallbackCallback } from './types';\n\n/**\n * @return A function that schedules a callback when the browser is idle or via setTimeout on the server.\n */\nexport function createRequestIdleCallback() {\n\tif ( typeof window === 'undefined' ) {\n\t\treturn ( callback: RequestIdleCallbackCallback ) => {\n\t\t\tsetTimeout( () => callback( Date.now() ), 0 );\n\t\t};\n\t}\n\n\treturn window.requestIdleCallback;\n}\n\nexport default createRequestIdleCallback();\n"],"mappings":";;;;;;;AAGAA,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACO,SAASC,yBAAyBA,CAAA,EAAG;EAC3C,IAAK,OAAOC,MAAM,KAAK,WAAW,EAAG;IACpC,OAASC,QAAqC,IAAM;MACnDC,UAAU,CAAE,MAAMD,QAAQ,CAAEE,IAAI,CAACC,GAAG,CAAC,CAAE,CAAC,EAAE,CAAE,CAAC;IAC9C,CAAC;EACF;EAEA,OAAOJ,MAAM,CAACK,mBAAmB;AAClC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcT,yBAAyB,CAAC,CAAC","ignoreList":[]}
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/priority-queue/src/types.ts"],"sourcesContent":["export type RequestIdleCallbackCallback = (\n\t/**\n\t * @param timeOrDeadline - IdleDeadline object or a timestamp number.\n\t */\n\ttimeOrDeadline: IdleDeadline | number\n) => void;\n"],"mappings":"","ignoreList":[]}
|
package/build-module/index.js
CHANGED
|
@@ -5,43 +5,14 @@ import requestIdleCallback from './request-idle-callback';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Enqueued callback to invoke once idle time permits.
|
|
8
|
-
*
|
|
9
|
-
* @typedef {()=>void} WPPriorityQueueCallback
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* An object used to associate callbacks in a particular context grouping.
|
|
14
|
-
*
|
|
15
|
-
* @typedef {{}} WPPriorityQueueContext
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Function to add callback to priority queue.
|
|
20
|
-
*
|
|
21
|
-
* @typedef {(element:WPPriorityQueueContext,item:WPPriorityQueueCallback)=>void} WPPriorityQueueAdd
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Function to flush callbacks from priority queue.
|
|
26
|
-
*
|
|
27
|
-
* @typedef {(element:WPPriorityQueueContext)=>boolean} WPPriorityQueueFlush
|
|
28
12
|
*/
|
|
29
13
|
|
|
30
14
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @typedef {()=>void} WPPriorityQueueReset
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Priority queue instance.
|
|
38
|
-
*
|
|
39
|
-
* @typedef {Object} WPPriorityQueue
|
|
40
|
-
*
|
|
41
|
-
* @property {WPPriorityQueueAdd} add Add callback to queue for context.
|
|
42
|
-
* @property {WPPriorityQueueFlush} flush Flush queue for context.
|
|
43
|
-
* @property {WPPriorityQueueFlush} cancel Clear queue for context.
|
|
44
|
-
* @property {WPPriorityQueueReset} reset Reset queue.
|
|
15
|
+
* Interface for the priority queue instance.
|
|
45
16
|
*/
|
|
46
17
|
|
|
47
18
|
/**
|
|
@@ -67,7 +38,6 @@ import requestIdleCallback from './request-idle-callback';
|
|
|
67
38
|
* @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods.
|
|
68
39
|
*/
|
|
69
40
|
export const createQueue = () => {
|
|
70
|
-
/** @type {Map<WPPriorityQueueContext, WPPriorityQueueCallback>} */
|
|
71
41
|
const waitingList = new Map();
|
|
72
42
|
let isRunning = false;
|
|
73
43
|
|
|
@@ -110,8 +80,6 @@ export const createQueue = () => {
|
|
|
110
80
|
* in their second parameter. Missing dependencies can cause unexpected
|
|
111
81
|
* loops and race conditions in the queue.
|
|
112
82
|
*
|
|
113
|
-
* @type {WPPriorityQueueAdd}
|
|
114
|
-
*
|
|
115
83
|
* @param {WPPriorityQueueContext} element Context object.
|
|
116
84
|
* @param {WPPriorityQueueCallback} item Callback function.
|
|
117
85
|
*/
|
|
@@ -127,8 +95,6 @@ export const createQueue = () => {
|
|
|
127
95
|
* Flushes queue for a given context, returning true if the flush was
|
|
128
96
|
* performed, or false if there is no queue for the given context.
|
|
129
97
|
*
|
|
130
|
-
* @type {WPPriorityQueueFlush}
|
|
131
|
-
*
|
|
132
98
|
* @param {WPPriorityQueueContext} element Context object.
|
|
133
99
|
*
|
|
134
100
|
* @return {boolean} Whether flush was performed.
|
|
@@ -148,8 +114,6 @@ export const createQueue = () => {
|
|
|
148
114
|
* executing them. Returns `true` if there were scheduled callbacks to cancel,
|
|
149
115
|
* or `false` if there was is no queue for the given context.
|
|
150
116
|
*
|
|
151
|
-
* @type {WPPriorityQueueFlush}
|
|
152
|
-
*
|
|
153
117
|
* @param {WPPriorityQueueContext} element Context object.
|
|
154
118
|
*
|
|
155
119
|
* @return {boolean} Whether any callbacks got cancelled.
|
|
@@ -160,8 +124,6 @@ export const createQueue = () => {
|
|
|
160
124
|
|
|
161
125
|
/**
|
|
162
126
|
* Reset the queue without running the pending callbacks.
|
|
163
|
-
*
|
|
164
|
-
* @type {WPPriorityQueueReset}
|
|
165
127
|
*/
|
|
166
128
|
const reset = () => {
|
|
167
129
|
waitingList.clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["requestIdleCallback","createQueue","waitingList","Map","isRunning","runWaitingList","deadline","nextElement","callback","delete","timeRemaining","size","add","element","item","set","flush","get","undefined","cancel","reset","clear"],"sources":["@wordpress/priority-queue/src/index.
|
|
1
|
+
{"version":3,"names":["requestIdleCallback","createQueue","waitingList","Map","isRunning","runWaitingList","deadline","nextElement","callback","delete","timeRemaining","size","add","element","item","set","flush","get","undefined","cancel","reset","clear"],"sources":["@wordpress/priority-queue/src/index.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport requestIdleCallback from './request-idle-callback';\n\n/**\n * Enqueued callback to invoke once idle time permits.\n */\nexport type WPPriorityQueueCallback = VoidFunction;\n\n/**\n * An object used to associate callbacks in a particular context grouping.\n */\nexport type WPPriorityQueueContext = object;\n\n/**\n * Interface for the priority queue instance.\n */\nexport interface WPPriorityQueue {\n\t/**\n\t * Add a callback to the queue for a given context.\n\t */\n\tadd: (\n\t\telement: WPPriorityQueueContext,\n\t\titem: WPPriorityQueueCallback\n\t) => void;\n\n\t/**\n\t * Flush and run the callback for a given context immediately.\n\t * @return true if a callback was run, false otherwise.\n\t */\n\tflush: ( element: WPPriorityQueueContext ) => boolean;\n\n\t/**\n\t * Cancel (remove) the callback for a given context without running it.\n\t * @return true if a callback was cancelled, false otherwise.\n\t */\n\tcancel: ( element: WPPriorityQueueContext ) => boolean;\n\n\t/**\n\t * Reset the entire queue, clearing pending callbacks.\n\t */\n\treset: VoidFunction;\n}\n\n/**\n * Creates a context-aware queue that only executes\n * the last task of a given context.\n *\n * @example\n *```js\n * import { createQueue } from '@wordpress/priority-queue';\n *\n * const queue = createQueue();\n *\n * // Context objects.\n * const ctx1 = {};\n * const ctx2 = {};\n *\n * // For a given context in the queue, only the last callback is executed.\n * queue.add( ctx1, () => console.log( 'This will be printed first' ) );\n * queue.add( ctx2, () => console.log( 'This won\\'t be printed' ) );\n * queue.add( ctx2, () => console.log( 'This will be printed second' ) );\n *```\n *\n * @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods.\n */\nexport const createQueue = (): WPPriorityQueue => {\n\tconst waitingList = new Map<\n\t\tWPPriorityQueueContext,\n\t\tWPPriorityQueueCallback\n\t>();\n\tlet isRunning = false;\n\n\t/**\n\t * Callback to process as much queue as time permits.\n\t *\n\t * Map Iteration follows the original insertion order. This means that here\n\t * we can iterate the queue and know that the first contexts which were\n\t * added will be run first. On the other hand, if anyone adds a new callback\n\t * for an existing context it will supplant the previously-set callback for\n\t * that context because we reassigned that map key's value.\n\t *\n\t * In the case that a callback adds a new callback to its own context then\n\t * the callback it adds will appear at the end of the iteration and will be\n\t * run only after all other existing contexts have finished executing.\n\t *\n\t * @param {IdleDeadline|number} deadline Idle callback deadline object, or\n\t * animation frame timestamp.\n\t */\n\tconst runWaitingList = ( deadline: IdleDeadline | number ): void => {\n\t\tfor ( const [ nextElement, callback ] of waitingList ) {\n\t\t\twaitingList.delete( nextElement );\n\t\t\tcallback();\n\n\t\t\tif (\n\t\t\t\t'number' === typeof deadline ||\n\t\t\t\tdeadline.timeRemaining() <= 0\n\t\t\t) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( waitingList.size === 0 ) {\n\t\t\tisRunning = false;\n\t\t\treturn;\n\t\t}\n\n\t\trequestIdleCallback( runWaitingList );\n\t};\n\n\t/**\n\t * Add a callback to the queue for a given context.\n\t *\n\t * If errors with undefined callbacks are encountered double check that\n\t * all of your useSelect calls have the right dependencies set correctly\n\t * in their second parameter. Missing dependencies can cause unexpected\n\t * loops and race conditions in the queue.\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t * @param {WPPriorityQueueCallback} item Callback function.\n\t */\n\tconst add: WPPriorityQueue[ 'add' ] = (\n\t\telement: WPPriorityQueueContext,\n\t\titem: WPPriorityQueueCallback\n\t) => {\n\t\twaitingList.set( element, item );\n\t\tif ( ! isRunning ) {\n\t\t\tisRunning = true;\n\t\t\trequestIdleCallback( runWaitingList );\n\t\t}\n\t};\n\n\t/**\n\t * Flushes queue for a given context, returning true if the flush was\n\t * performed, or false if there is no queue for the given context.\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t *\n\t * @return {boolean} Whether flush was performed.\n\t */\n\tconst flush: WPPriorityQueue[ 'flush' ] = (\n\t\telement: WPPriorityQueueContext\n\t) => {\n\t\tconst callback = waitingList.get( element );\n\t\tif ( undefined === callback ) {\n\t\t\treturn false;\n\t\t}\n\n\t\twaitingList.delete( element );\n\t\tcallback();\n\n\t\treturn true;\n\t};\n\n\t/**\n\t * Clears the queue for a given context, cancelling the callbacks without\n\t * executing them. Returns `true` if there were scheduled callbacks to cancel,\n\t * or `false` if there was is no queue for the given context.\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t *\n\t * @return {boolean} Whether any callbacks got cancelled.\n\t */\n\tconst cancel: WPPriorityQueue[ 'cancel' ] = (\n\t\telement: WPPriorityQueueContext\n\t) => {\n\t\treturn waitingList.delete( element );\n\t};\n\n\t/**\n\t * Reset the queue without running the pending callbacks.\n\t */\n\tconst reset: WPPriorityQueue[ 'reset' ] = () => {\n\t\twaitingList.clear();\n\t\tisRunning = false;\n\t};\n\n\treturn {\n\t\tadd,\n\t\tflush,\n\t\tcancel,\n\t\treset,\n\t};\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,mBAAmB,MAAM,yBAAyB;;AAEzD;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGA,CAAA,KAAuB;EACjD,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAGzB,CAAC;EACH,IAAIC,SAAS,GAAG,KAAK;;EAErB;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMC,cAAc,GAAKC,QAA+B,IAAY;IACnE,KAAM,MAAM,CAAEC,WAAW,EAAEC,QAAQ,CAAE,IAAIN,WAAW,EAAG;MACtDA,WAAW,CAACO,MAAM,CAAEF,WAAY,CAAC;MACjCC,QAAQ,CAAC,CAAC;MAEV,IACC,QAAQ,KAAK,OAAOF,QAAQ,IAC5BA,QAAQ,CAACI,aAAa,CAAC,CAAC,IAAI,CAAC,EAC5B;QACD;MACD;IACD;IAEA,IAAKR,WAAW,CAACS,IAAI,KAAK,CAAC,EAAG;MAC7BP,SAAS,GAAG,KAAK;MACjB;IACD;IAEAJ,mBAAmB,CAAEK,cAAe,CAAC;EACtC,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMO,GAA6B,GAAGA,CACrCC,OAA+B,EAC/BC,IAA6B,KACzB;IACJZ,WAAW,CAACa,GAAG,CAAEF,OAAO,EAAEC,IAAK,CAAC;IAChC,IAAK,CAAEV,SAAS,EAAG;MAClBA,SAAS,GAAG,IAAI;MAChBJ,mBAAmB,CAAEK,cAAe,CAAC;IACtC;EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMW,KAAiC,GACtCH,OAA+B,IAC3B;IACJ,MAAML,QAAQ,GAAGN,WAAW,CAACe,GAAG,CAAEJ,OAAQ,CAAC;IAC3C,IAAKK,SAAS,KAAKV,QAAQ,EAAG;MAC7B,OAAO,KAAK;IACb;IAEAN,WAAW,CAACO,MAAM,CAAEI,OAAQ,CAAC;IAC7BL,QAAQ,CAAC,CAAC;IAEV,OAAO,IAAI;EACZ,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMW,MAAmC,GACxCN,OAA+B,IAC3B;IACJ,OAAOX,WAAW,CAACO,MAAM,CAAEI,OAAQ,CAAC;EACrC,CAAC;;EAED;AACD;AACA;EACC,MAAMO,KAAiC,GAAGA,CAAA,KAAM;IAC/ClB,WAAW,CAACmB,KAAK,CAAC,CAAC;IACnBjB,SAAS,GAAG,KAAK;EAClB,CAAC;EAED,OAAO;IACNQ,GAAG;IACHI,KAAK;IACLG,MAAM;IACNC;EACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import 'requestidlecallback';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @return
|
|
11
|
+
* @return A function that schedules a callback when the browser is idle or via setTimeout on the server.
|
|
12
12
|
*/
|
|
13
13
|
export function createRequestIdleCallback() {
|
|
14
14
|
if (typeof window === 'undefined') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createRequestIdleCallback","window","callback","setTimeout","Date","now","requestIdleCallback"],"sources":["@wordpress/priority-queue/src/request-idle-callback.
|
|
1
|
+
{"version":3,"names":["createRequestIdleCallback","window","callback","setTimeout","Date","now","requestIdleCallback"],"sources":["@wordpress/priority-queue/src/request-idle-callback.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport 'requestidlecallback';\n\n/**\n * Internal dependencies\n */\nimport type { RequestIdleCallbackCallback } from './types';\n\n/**\n * @return A function that schedules a callback when the browser is idle or via setTimeout on the server.\n */\nexport function createRequestIdleCallback() {\n\tif ( typeof window === 'undefined' ) {\n\t\treturn ( callback: RequestIdleCallbackCallback ) => {\n\t\t\tsetTimeout( () => callback( Date.now() ), 0 );\n\t\t};\n\t}\n\n\treturn window.requestIdleCallback;\n}\n\nexport default createRequestIdleCallback();\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,qBAAqB;;AAE5B;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO,SAASA,yBAAyBA,CAAA,EAAG;EAC3C,IAAK,OAAOC,MAAM,KAAK,WAAW,EAAG;IACpC,OAASC,QAAqC,IAAM;MACnDC,UAAU,CAAE,MAAMD,QAAQ,CAAEE,IAAI,CAACC,GAAG,CAAC,CAAE,CAAC,EAAE,CAAE,CAAC;IAC9C,CAAC;EACF;EAEA,OAAOJ,MAAM,CAACK,mBAAmB;AAClC;AAEA,eAAeN,yBAAyB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/priority-queue/src/types.ts"],"sourcesContent":["export type RequestIdleCallbackCallback = (\n\t/**\n\t * @param timeOrDeadline - IdleDeadline object or a timestamp number.\n\t */\n\ttimeOrDeadline: IdleDeadline | number\n) => void;\n"],"mappings":"","ignoreList":[]}
|
package/build-types/index.d.ts
CHANGED
|
@@ -1,43 +1,55 @@
|
|
|
1
|
-
export function createQueue(): WPPriorityQueue;
|
|
2
1
|
/**
|
|
3
2
|
* Enqueued callback to invoke once idle time permits.
|
|
4
3
|
*/
|
|
5
|
-
export type WPPriorityQueueCallback =
|
|
4
|
+
export type WPPriorityQueueCallback = VoidFunction;
|
|
6
5
|
/**
|
|
7
6
|
* An object used to associate callbacks in a particular context grouping.
|
|
8
7
|
*/
|
|
9
|
-
export type WPPriorityQueueContext =
|
|
8
|
+
export type WPPriorityQueueContext = object;
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
10
|
+
* Interface for the priority queue instance.
|
|
12
11
|
*/
|
|
13
|
-
export
|
|
14
|
-
/**
|
|
15
|
-
* Function to flush callbacks from priority queue.
|
|
16
|
-
*/
|
|
17
|
-
export type WPPriorityQueueFlush = (element: WPPriorityQueueContext) => boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Reset the queue.
|
|
20
|
-
*/
|
|
21
|
-
export type WPPriorityQueueReset = () => void;
|
|
22
|
-
/**
|
|
23
|
-
* Priority queue instance.
|
|
24
|
-
*/
|
|
25
|
-
export type WPPriorityQueue = {
|
|
12
|
+
export interface WPPriorityQueue {
|
|
26
13
|
/**
|
|
27
|
-
* Add callback to queue for context.
|
|
14
|
+
* Add a callback to the queue for a given context.
|
|
28
15
|
*/
|
|
29
|
-
add:
|
|
16
|
+
add: (element: WPPriorityQueueContext, item: WPPriorityQueueCallback) => void;
|
|
30
17
|
/**
|
|
31
|
-
* Flush
|
|
18
|
+
* Flush and run the callback for a given context immediately.
|
|
19
|
+
* @return true if a callback was run, false otherwise.
|
|
32
20
|
*/
|
|
33
|
-
flush:
|
|
21
|
+
flush: (element: WPPriorityQueueContext) => boolean;
|
|
34
22
|
/**
|
|
35
|
-
*
|
|
23
|
+
* Cancel (remove) the callback for a given context without running it.
|
|
24
|
+
* @return true if a callback was cancelled, false otherwise.
|
|
36
25
|
*/
|
|
37
|
-
cancel:
|
|
26
|
+
cancel: (element: WPPriorityQueueContext) => boolean;
|
|
38
27
|
/**
|
|
39
|
-
* Reset queue.
|
|
28
|
+
* Reset the entire queue, clearing pending callbacks.
|
|
40
29
|
*/
|
|
41
|
-
reset:
|
|
42
|
-
}
|
|
30
|
+
reset: VoidFunction;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a context-aware queue that only executes
|
|
34
|
+
* the last task of a given context.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
*```js
|
|
38
|
+
* import { createQueue } from '@wordpress/priority-queue';
|
|
39
|
+
*
|
|
40
|
+
* const queue = createQueue();
|
|
41
|
+
*
|
|
42
|
+
* // Context objects.
|
|
43
|
+
* const ctx1 = {};
|
|
44
|
+
* const ctx2 = {};
|
|
45
|
+
*
|
|
46
|
+
* // For a given context in the queue, only the last callback is executed.
|
|
47
|
+
* queue.add( ctx1, () => console.log( 'This will be printed first' ) );
|
|
48
|
+
* queue.add( ctx2, () => console.log( 'This won\'t be printed' ) );
|
|
49
|
+
* queue.add( ctx2, () => console.log( 'This will be printed second' ) );
|
|
50
|
+
*```
|
|
51
|
+
*
|
|
52
|
+
* @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods.
|
|
53
|
+
*/
|
|
54
|
+
export declare const createQueue: () => WPPriorityQueue;
|
|
43
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,GAAG,EAAE,CACJ,OAAO,EAAE,sBAAsB,EAC/B,IAAI,EAAE,uBAAuB,KACzB,IAAI,CAAC;IAEV;;;OAGG;IACH,KAAK,EAAE,CAAE,OAAO,EAAE,sBAAsB,KAAM,OAAO,CAAC;IAEtD;;;OAGG;IACH,MAAM,EAAE,CAAE,OAAO,EAAE,sBAAsB,KAAM,OAAO,CAAC;IAEvD;;OAEG;IACH,KAAK,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,QAAO,eAqH9B,CAAC"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* External dependencies
|
|
3
3
|
*/
|
|
4
|
+
import 'requestidlecallback';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Internal dependencies
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import type { RequestIdleCallbackCallback } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* @return A function that schedules a callback when the browser is idle or via setTimeout on the server.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createRequestIdleCallback(): ((callback: RequestIdleCallbackCallback) => void) | ({
|
|
13
|
+
(callback: IdleRequestCallback, options?: IdleRequestOptions): number;
|
|
14
|
+
(callback: (deadline: IdleDeadline) => void, options?: IdleRequestOptions): IdleCallbackHandle;
|
|
15
|
+
} & typeof requestIdleCallback);
|
|
16
|
+
declare const _default: ((callback: RequestIdleCallbackCallback) => void) | ({
|
|
17
|
+
(callback: IdleRequestCallback, options?: IdleRequestOptions): number;
|
|
18
|
+
(callback: (deadline: IdleDeadline) => void, options?: IdleRequestOptions): IdleCallbackHandle;
|
|
19
|
+
} & typeof requestIdleCallback);
|
|
9
20
|
export default _default;
|
|
10
|
-
export type Callback = (timeOrDeadline: IdleDeadline | number) => void;
|
|
11
21
|
//# sourceMappingURL=request-idle-callback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-idle-callback.d.ts","sourceRoot":"","sources":["../src/request-idle-callback.
|
|
1
|
+
{"version":3,"file":"request-idle-callback.d.ts","sourceRoot":"","sources":["../src/request-idle-callback.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAE7B;;GAEG;AACH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D;;GAEG;AACH,wBAAgB,yBAAyB,gBAEpB,2BAA2B;;;gCAM/C;oCANoB,2BAA2B;;;;AAQhD,wBAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;AACzC;;GAEG;AACH,cAAc,EAAE,YAAY,GAAG,MAAM,KACjC,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/priority-queue",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.1-next.46f643fa0.0",
|
|
4
4
|
"description": "Generic browser priority queue.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "17e600e091675c5e3d809adfea23ac456bbeae19"
|
|
40
40
|
}
|
|
@@ -5,44 +5,43 @@ import requestIdleCallback from './request-idle-callback';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Enqueued callback to invoke once idle time permits.
|
|
8
|
-
*
|
|
9
|
-
* @typedef {()=>void} WPPriorityQueueCallback
|
|
10
8
|
*/
|
|
9
|
+
export type WPPriorityQueueCallback = VoidFunction;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* An object used to associate callbacks in a particular context grouping.
|
|
14
|
-
*
|
|
15
|
-
* @typedef {{}} WPPriorityQueueContext
|
|
16
13
|
*/
|
|
14
|
+
export type WPPriorityQueueContext = object;
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @typedef {(element:WPPriorityQueueContext,item:WPPriorityQueueCallback)=>void} WPPriorityQueueAdd
|
|
17
|
+
* Interface for the priority queue instance.
|
|
22
18
|
*/
|
|
19
|
+
export interface WPPriorityQueue {
|
|
20
|
+
/**
|
|
21
|
+
* Add a callback to the queue for a given context.
|
|
22
|
+
*/
|
|
23
|
+
add: (
|
|
24
|
+
element: WPPriorityQueueContext,
|
|
25
|
+
item: WPPriorityQueueCallback
|
|
26
|
+
) => void;
|
|
23
27
|
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Flush and run the callback for a given context immediately.
|
|
30
|
+
* @return true if a callback was run, false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
flush: ( element: WPPriorityQueueContext ) => boolean;
|
|
29
33
|
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Cancel (remove) the callback for a given context without running it.
|
|
36
|
+
* @return true if a callback was cancelled, false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
cancel: ( element: WPPriorityQueueContext ) => boolean;
|
|
35
39
|
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* @property {WPPriorityQueueAdd} add Add callback to queue for context.
|
|
42
|
-
* @property {WPPriorityQueueFlush} flush Flush queue for context.
|
|
43
|
-
* @property {WPPriorityQueueFlush} cancel Clear queue for context.
|
|
44
|
-
* @property {WPPriorityQueueReset} reset Reset queue.
|
|
45
|
-
*/
|
|
40
|
+
/**
|
|
41
|
+
* Reset the entire queue, clearing pending callbacks.
|
|
42
|
+
*/
|
|
43
|
+
reset: VoidFunction;
|
|
44
|
+
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
* Creates a context-aware queue that only executes
|
|
@@ -66,9 +65,11 @@ import requestIdleCallback from './request-idle-callback';
|
|
|
66
65
|
*
|
|
67
66
|
* @return {WPPriorityQueue} Queue object with `add`, `flush` and `reset` methods.
|
|
68
67
|
*/
|
|
69
|
-
export const createQueue = () => {
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
export const createQueue = (): WPPriorityQueue => {
|
|
69
|
+
const waitingList = new Map<
|
|
70
|
+
WPPriorityQueueContext,
|
|
71
|
+
WPPriorityQueueCallback
|
|
72
|
+
>();
|
|
72
73
|
let isRunning = false;
|
|
73
74
|
|
|
74
75
|
/**
|
|
@@ -87,7 +88,7 @@ export const createQueue = () => {
|
|
|
87
88
|
* @param {IdleDeadline|number} deadline Idle callback deadline object, or
|
|
88
89
|
* animation frame timestamp.
|
|
89
90
|
*/
|
|
90
|
-
const runWaitingList = ( deadline ) => {
|
|
91
|
+
const runWaitingList = ( deadline: IdleDeadline | number ): void => {
|
|
91
92
|
for ( const [ nextElement, callback ] of waitingList ) {
|
|
92
93
|
waitingList.delete( nextElement );
|
|
93
94
|
callback();
|
|
@@ -116,12 +117,13 @@ export const createQueue = () => {
|
|
|
116
117
|
* in their second parameter. Missing dependencies can cause unexpected
|
|
117
118
|
* loops and race conditions in the queue.
|
|
118
119
|
*
|
|
119
|
-
* @type {WPPriorityQueueAdd}
|
|
120
|
-
*
|
|
121
120
|
* @param {WPPriorityQueueContext} element Context object.
|
|
122
121
|
* @param {WPPriorityQueueCallback} item Callback function.
|
|
123
122
|
*/
|
|
124
|
-
const add
|
|
123
|
+
const add: WPPriorityQueue[ 'add' ] = (
|
|
124
|
+
element: WPPriorityQueueContext,
|
|
125
|
+
item: WPPriorityQueueCallback
|
|
126
|
+
) => {
|
|
125
127
|
waitingList.set( element, item );
|
|
126
128
|
if ( ! isRunning ) {
|
|
127
129
|
isRunning = true;
|
|
@@ -133,13 +135,13 @@ export const createQueue = () => {
|
|
|
133
135
|
* Flushes queue for a given context, returning true if the flush was
|
|
134
136
|
* performed, or false if there is no queue for the given context.
|
|
135
137
|
*
|
|
136
|
-
* @type {WPPriorityQueueFlush}
|
|
137
|
-
*
|
|
138
138
|
* @param {WPPriorityQueueContext} element Context object.
|
|
139
139
|
*
|
|
140
140
|
* @return {boolean} Whether flush was performed.
|
|
141
141
|
*/
|
|
142
|
-
const flush
|
|
142
|
+
const flush: WPPriorityQueue[ 'flush' ] = (
|
|
143
|
+
element: WPPriorityQueueContext
|
|
144
|
+
) => {
|
|
143
145
|
const callback = waitingList.get( element );
|
|
144
146
|
if ( undefined === callback ) {
|
|
145
147
|
return false;
|
|
@@ -156,22 +158,20 @@ export const createQueue = () => {
|
|
|
156
158
|
* executing them. Returns `true` if there were scheduled callbacks to cancel,
|
|
157
159
|
* or `false` if there was is no queue for the given context.
|
|
158
160
|
*
|
|
159
|
-
* @type {WPPriorityQueueFlush}
|
|
160
|
-
*
|
|
161
161
|
* @param {WPPriorityQueueContext} element Context object.
|
|
162
162
|
*
|
|
163
163
|
* @return {boolean} Whether any callbacks got cancelled.
|
|
164
164
|
*/
|
|
165
|
-
const cancel
|
|
165
|
+
const cancel: WPPriorityQueue[ 'cancel' ] = (
|
|
166
|
+
element: WPPriorityQueueContext
|
|
167
|
+
) => {
|
|
166
168
|
return waitingList.delete( element );
|
|
167
169
|
};
|
|
168
170
|
|
|
169
171
|
/**
|
|
170
172
|
* Reset the queue without running the pending callbacks.
|
|
171
|
-
*
|
|
172
|
-
* @type {WPPriorityQueueReset}
|
|
173
173
|
*/
|
|
174
|
-
const reset = () => {
|
|
174
|
+
const reset: WPPriorityQueue[ 'reset' ] = () => {
|
|
175
175
|
waitingList.clear();
|
|
176
176
|
isRunning = false;
|
|
177
177
|
};
|
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
import 'requestidlecallback';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
+
import type { RequestIdleCallbackCallback } from './types';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
* @return
|
|
12
|
+
* @return A function that schedules a callback when the browser is idle or via setTimeout on the server.
|
|
12
13
|
*/
|
|
13
14
|
export function createRequestIdleCallback() {
|
|
14
15
|
if ( typeof window === 'undefined' ) {
|
|
15
|
-
return ( callback ) => {
|
|
16
|
+
return ( callback: RequestIdleCallbackCallback ) => {
|
|
16
17
|
setTimeout( () => callback( Date.now() ), 0 );
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createQueue } from '../';
|
|
5
|
-
import
|
|
5
|
+
import _requestIdleCallback from '../request-idle-callback';
|
|
6
|
+
|
|
7
|
+
const requestIdleCallback =
|
|
8
|
+
_requestIdleCallback as typeof _requestIdleCallback & {
|
|
9
|
+
tick: ( deadline?: Partial< IdleDeadline > | number ) => void;
|
|
10
|
+
};
|
|
6
11
|
|
|
7
12
|
jest.mock( '../request-idle-callback', () => {
|
|
8
13
|
const emitter = new ( jest.requireActual( 'events' ).EventEmitter )();
|
|
@@ -17,7 +22,7 @@ jest.mock( '../request-idle-callback', () => {
|
|
|
17
22
|
} );
|
|
18
23
|
|
|
19
24
|
describe( 'createQueue', () => {
|
|
20
|
-
let queue
|
|
25
|
+
let queue: ReturnType< typeof createQueue >;
|
|
21
26
|
beforeEach( () => {
|
|
22
27
|
queue = createQueue();
|
|
23
28
|
} );
|
package/src/types.ts
ADDED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.es2024.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2024.collection.d.ts","../../node_modules/typescript/lib/lib.es2024.object.d.ts","../../node_modules/typescript/lib/lib.es2024.promise.d.ts","../../node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2024.string.d.ts","../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/@types/requestidlecallback/index.d.ts","./src/request-idle-callback.js","./src/index.js"],"fileIdsList":[[80]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"e12a46ce14b817d4c9e6b2b478956452330bf00c9801b79de46f7a1815b5bd40","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"69e65d976bf166ce4a9e6f6c18f94d2424bf116e90837ace179610dbccad9b42","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"bab26767638ab3557de12c900f0b91f710c7dc40ee9793d5a27d32c04f0bf646","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"61d6a2092f48af66dbfb220e31eea8b10bc02b6932d6e529005fd2d7b3281290","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"9b66eb641b8ff1824e4d04022ba1a051c5c10746ea94147b24c2f5e27c5f9c88","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7da0a20216d07d275da4d90bef16c4229b9c3251e2d68ef0762f9bb20e70594","signature":"a15f7dd889b616cdf07d6286e9d6083823bfde7ce46a36521043201d207df652"},{"version":"77efe10d427aee10bf7c467d6d9a0e4f0fcb84811d679be612d53b2e8dd17a76","signature":"2a57cbf1f516e1a2da6e22644f4517479c3ea3f28ff13aefcb1999c0d31c23f0"}],"root":[80,81],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"checkJs":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"rootDir":"./src","skipDefaultLibCheck":true,"strict":true,"target":99},"referencedMap":[[81,1]],"latestChangedDtsFile":"./build-types/index.d.ts","version":"5.7.2"}
|
|
1
|
+
{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.es2024.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2024.collection.d.ts","../../node_modules/typescript/lib/lib.es2024.object.d.ts","../../node_modules/typescript/lib/lib.es2024.promise.d.ts","../../node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2024.string.d.ts","../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/@types/requestidlecallback/index.d.ts","./src/types.ts","./src/request-idle-callback.ts","./src/index.ts"],"fileIdsList":[[81],[80]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"e12a46ce14b817d4c9e6b2b478956452330bf00c9801b79de46f7a1815b5bd40","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"69e65d976bf166ce4a9e6f6c18f94d2424bf116e90837ace179610dbccad9b42","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"bab26767638ab3557de12c900f0b91f710c7dc40ee9793d5a27d32c04f0bf646","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"61d6a2092f48af66dbfb220e31eea8b10bc02b6932d6e529005fd2d7b3281290","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"9b66eb641b8ff1824e4d04022ba1a051c5c10746ea94147b24c2f5e27c5f9c88","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea0b1535c3c701c597c8161c8ff6ddac43b770facdee4c54f71f1597854dc193","signature":"390258f5f8637ffc28ee1164af0ad1bb20b6e6b25a772f8902ef509786adee66"},{"version":"42323b50fdf111a02eabd39f5c8855206b1df8731106e0d55da224b5397ba5b7","signature":"b9833a345a9597787601fa4afb98129becdbb78617e26dfe36f70c2e75df18c7"},{"version":"9cd5fd81e1a82af9178b44af7a4b06bc381c639cf70b33aa10b95f63dc935991","signature":"103fcdee658feec84fa7edb8889dcbb19fe85232e2f038a8e615c8d04f620c7a"}],"root":[[80,82]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"checkJs":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"rootDir":"./src","skipDefaultLibCheck":true,"strict":true,"target":99},"referencedMap":[[82,1],[81,2]],"latestChangedDtsFile":"./build-types/index.d.ts","version":"5.7.2"}
|