@wordpress/priority-queue 2.5.0 → 2.7.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 +8 -0
- package/build/index.js +28 -3
- package/build/index.js.map +1 -1
- package/build-module/index.js +28 -3
- package/build-module/index.js.map +1 -1
- package/build-types/index.d.ts +4 -0
- package/build-types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.js +28 -3
- package/src/test/index.js +27 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
package/build/index.js
CHANGED
|
@@ -48,9 +48,10 @@ var _requestIdleCallback = _interopRequireDefault(require("./request-idle-callba
|
|
|
48
48
|
*
|
|
49
49
|
* @typedef {Object} WPPriorityQueue
|
|
50
50
|
*
|
|
51
|
-
* @property {WPPriorityQueueAdd} add
|
|
52
|
-
* @property {WPPriorityQueueFlush} flush
|
|
53
|
-
* @property {
|
|
51
|
+
* @property {WPPriorityQueueAdd} add Add callback to queue for context.
|
|
52
|
+
* @property {WPPriorityQueueFlush} flush Flush queue for context.
|
|
53
|
+
* @property {WPPriorityQueueFlush} cancel Clear queue for context.
|
|
54
|
+
* @property {WPPriorityQueueReset} reset Reset queue.
|
|
54
55
|
*/
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -161,6 +162,29 @@ const createQueue = () => {
|
|
|
161
162
|
callback();
|
|
162
163
|
return true;
|
|
163
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Clears the queue for a given context, cancelling the callbacks without
|
|
167
|
+
* executing them. Returns `true` if there were scheduled callbacks to cancel,
|
|
168
|
+
* or `false` if there was is no queue for the given context.
|
|
169
|
+
*
|
|
170
|
+
* @type {WPPriorityQueueFlush}
|
|
171
|
+
*
|
|
172
|
+
* @param {WPPriorityQueueContext} element Context object.
|
|
173
|
+
*
|
|
174
|
+
* @return {boolean} Whether any callbacks got cancelled.
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
const cancel = element => {
|
|
179
|
+
if (!elementsMap.has(element)) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const index = waitingList.indexOf(element);
|
|
184
|
+
waitingList.splice(index, 1);
|
|
185
|
+
elementsMap.delete(element);
|
|
186
|
+
return true;
|
|
187
|
+
};
|
|
164
188
|
/**
|
|
165
189
|
* Reset the queue without running the pending callbacks.
|
|
166
190
|
*
|
|
@@ -177,6 +201,7 @@ const createQueue = () => {
|
|
|
177
201
|
return {
|
|
178
202
|
add,
|
|
179
203
|
flush,
|
|
204
|
+
cancel,
|
|
180
205
|
reset
|
|
181
206
|
};
|
|
182
207
|
};
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/priority-queue/src/index.js"],"names":["createQueue","waitingList","elementsMap","WeakMap","isRunning","runWaitingList","deadline","hasTimeRemaining","timeRemaining","length","nextElement","shift","callback","get","delete","add","element","item","has","push","set","flush","index","indexOf","splice","reset"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,MAAM;AAChC;AACA,MAAIC,WAAW,GAAG,EAAlB;AAEA;;AACA,MAAIC,WAAW,GAAG,IAAIC,OAAJ,EAAlB;AAEA,MAAIC,SAAS,GAAG,KAAhB;AAEA;AACD;AACA;AACA;AACA;AACA;;AACC,QAAMC,cAAc,GAAKC,QAAF,IAAgB;AACtC,UAAMC,gBAAgB,GACrB,OAAOD,Q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G;AAAyCV,IAAAA,WAAW,CAACW,GAAZ,CACzDG,OADyD,CAA1D;AAGAd,IAAAA,WAAW,CAACY,MAAZ,CAAoBE,OAApB;AACAJ,IAAAA,QAAQ;AAER,WAAO,IAAP;AACA,GAdD;AAgBA;AACD;AACA;AACA;AACA;;;AACC,QAAMa,KAAK,GAAG,MAAM;
|
|
1
|
+
{"version":3,"sources":["@wordpress/priority-queue/src/index.js"],"names":["createQueue","waitingList","elementsMap","WeakMap","isRunning","runWaitingList","deadline","hasTimeRemaining","timeRemaining","length","nextElement","shift","callback","get","delete","add","element","item","has","push","set","flush","index","indexOf","splice","cancel","reset"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,MAAM;AAChC;AACA,MAAIC,WAAW,GAAG,EAAlB;AAEA;;AACA,MAAIC,WAAW,GAAG,IAAIC,OAAJ,EAAlB;AAEA,MAAIC,SAAS,GAAG,KAAhB;AAEA;AACD;AACA;AACA;AACA;AACA;;AACC,QAAMC,cAAc,GAAKC,QAAF,IAAgB;AACtC,UAAMC,gBAAgB,GACrB,OAAOD,QAAP,KAAoB,QAApB,GACG,MAAM,KADT,GAEG,MAAMA,QAAQ,CAACE,aAAT,KAA2B,CAHrC;;AAKA,OAAG;AACF,UAAKP,WAAW,CAACQ,MAAZ,KAAuB,CAA5B,EAAgC;AAC/BL,QAAAA,SAAS,GAAG,KAAZ;AACA;AACA;;AAED,YAAMM,WAAW;AAAG;AAAwCT,MAAAA,WAAW,CAACU,K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Ae;AAC7B,QAAK,CAAEd,WAAW,CAACgB,GAAZ,CAAiBF,OAAjB,CAAP,EAAoC;AACnC,aAAO,KAAP;AACA;;AAED,UAAMM,KAAK,GAAGrB,WAAW,CAACsB,OAAZ,CAAqBP,OAArB,CAAd;AACAf,IAAAA,WAAW,CAACuB,MAAZ,CAAoBF,KAApB,EAA2B,CAA3B;AACApB,IAAAA,WAAW,CAACY,MAAZ,CAAoBE,OAApB;AAEA,WAAO,IAAP;AACA,GAVD;AAYA;AACD;AACA;AACA;AACA;;;AACC,QAAMU,KAAK,GAAG,MAAM;AACnBzB,IAAAA,WAAW,GAAG,EAAd;AACAC,IAAAA,WAAW,GAAG,IAAIC,OAAJ,EAAd;AACAC,IAAAA,SAAS,GAAG,KAAZ;AACA,GAJD;;AAMA,SAAO;AACNW,IAAAA,GADM;AAENM,IAAAA,KAFM;AAGNI,IAAAA,MAHM;AAINC,IAAAA;AAJM,GAAP;AAMA,CA9HM","sourcesContent":["/**\n * Internal dependencies\n */\nimport requestIdleCallback from './request-idle-callback';\n\n/**\n * Enqueued callback to invoke once idle time permits.\n *\n * @typedef {()=>void} WPPriorityQueueCallback\n */\n\n/**\n * An object used to associate callbacks in a particular context grouping.\n *\n * @typedef {{}} WPPriorityQueueContext\n */\n\n/**\n * Function to add callback to priority queue.\n *\n * @typedef {(element:WPPriorityQueueContext,item:WPPriorityQueueCallback)=>void} WPPriorityQueueAdd\n */\n\n/**\n * Function to flush callbacks from priority queue.\n *\n * @typedef {(element:WPPriorityQueueContext)=>boolean} WPPriorityQueueFlush\n */\n\n/**\n * Reset the queue.\n *\n * @typedef {()=>void} WPPriorityQueueReset\n */\n\n/**\n * Priority queue instance.\n *\n * @typedef {Object} WPPriorityQueue\n *\n * @property {WPPriorityQueueAdd} add Add callback to queue for context.\n * @property {WPPriorityQueueFlush} flush Flush queue for context.\n * @property {WPPriorityQueueFlush} cancel Clear queue for context.\n * @property {WPPriorityQueueReset} reset Reset queue.\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 = () => {\n\t/** @type {WPPriorityQueueContext[]} */\n\tlet waitingList = [];\n\n\t/** @type {WeakMap<WPPriorityQueueContext,WPPriorityQueueCallback>} */\n\tlet elementsMap = new WeakMap();\n\n\tlet isRunning = false;\n\n\t/**\n\t * Callback to process as much queue as time permits.\n\t *\n\t * @param {IdleDeadline|number} deadline Idle callback deadline object, or\n\t * animation frame timestamp.\n\t */\n\tconst runWaitingList = ( deadline ) => {\n\t\tconst hasTimeRemaining =\n\t\t\ttypeof deadline === 'number'\n\t\t\t\t? () => false\n\t\t\t\t: () => deadline.timeRemaining() > 0;\n\n\t\tdo {\n\t\t\tif ( waitingList.length === 0 ) {\n\t\t\t\tisRunning = false;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextElement = /** @type {WPPriorityQueueContext} */ ( waitingList.shift() );\n\t\t\tconst callback = /** @type {WPPriorityQueueCallback} */ ( elementsMap.get(\n\t\t\t\tnextElement\n\t\t\t) );\n\t\t\t// If errors with undefined callbacks are encountered double check that all of your useSelect calls\n\t\t\t// have all dependecies set correctly in second parameter. Missing dependencies can cause unexpected\n\t\t\t// loops and race conditions in the queue.\n\t\t\tcallback();\n\t\t\telementsMap.delete( nextElement );\n\t\t} while ( hasTimeRemaining() );\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 * @type {WPPriorityQueueAdd}\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t * @param {WPPriorityQueueCallback} item Callback function.\n\t */\n\tconst add = ( element, item ) => {\n\t\tif ( ! elementsMap.has( element ) ) {\n\t\t\twaitingList.push( element );\n\t\t}\n\t\telementsMap.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 * @type {WPPriorityQueueFlush}\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t *\n\t * @return {boolean} Whether flush was performed.\n\t */\n\tconst flush = ( element ) => {\n\t\tif ( ! elementsMap.has( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst index = waitingList.indexOf( element );\n\t\twaitingList.splice( index, 1 );\n\t\tconst callback = /** @type {WPPriorityQueueCallback} */ ( elementsMap.get(\n\t\t\telement\n\t\t) );\n\t\telementsMap.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 * @type {WPPriorityQueueFlush}\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 = ( element ) => {\n\t\tif ( ! elementsMap.has( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst index = waitingList.indexOf( element );\n\t\twaitingList.splice( index, 1 );\n\t\telementsMap.delete( element );\n\n\t\treturn true;\n\t};\n\n\t/**\n\t * Reset the queue without running the pending callbacks.\n\t *\n\t * @type {WPPriorityQueueReset}\n\t */\n\tconst reset = () => {\n\t\twaitingList = [];\n\t\telementsMap = new WeakMap();\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"]}
|
package/build-module/index.js
CHANGED
|
@@ -37,9 +37,10 @@ import requestIdleCallback from './request-idle-callback';
|
|
|
37
37
|
*
|
|
38
38
|
* @typedef {Object} WPPriorityQueue
|
|
39
39
|
*
|
|
40
|
-
* @property {WPPriorityQueueAdd} add
|
|
41
|
-
* @property {WPPriorityQueueFlush} flush
|
|
42
|
-
* @property {
|
|
40
|
+
* @property {WPPriorityQueueAdd} add Add callback to queue for context.
|
|
41
|
+
* @property {WPPriorityQueueFlush} flush Flush queue for context.
|
|
42
|
+
* @property {WPPriorityQueueFlush} cancel Clear queue for context.
|
|
43
|
+
* @property {WPPriorityQueueReset} reset Reset queue.
|
|
43
44
|
*/
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -151,6 +152,29 @@ export const createQueue = () => {
|
|
|
151
152
|
callback();
|
|
152
153
|
return true;
|
|
153
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Clears the queue for a given context, cancelling the callbacks without
|
|
157
|
+
* executing them. Returns `true` if there were scheduled callbacks to cancel,
|
|
158
|
+
* or `false` if there was is no queue for the given context.
|
|
159
|
+
*
|
|
160
|
+
* @type {WPPriorityQueueFlush}
|
|
161
|
+
*
|
|
162
|
+
* @param {WPPriorityQueueContext} element Context object.
|
|
163
|
+
*
|
|
164
|
+
* @return {boolean} Whether any callbacks got cancelled.
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
const cancel = element => {
|
|
169
|
+
if (!elementsMap.has(element)) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const index = waitingList.indexOf(element);
|
|
174
|
+
waitingList.splice(index, 1);
|
|
175
|
+
elementsMap.delete(element);
|
|
176
|
+
return true;
|
|
177
|
+
};
|
|
154
178
|
/**
|
|
155
179
|
* Reset the queue without running the pending callbacks.
|
|
156
180
|
*
|
|
@@ -167,6 +191,7 @@ export const createQueue = () => {
|
|
|
167
191
|
return {
|
|
168
192
|
add,
|
|
169
193
|
flush,
|
|
194
|
+
cancel,
|
|
170
195
|
reset
|
|
171
196
|
};
|
|
172
197
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/priority-queue/src/index.js"],"names":["requestIdleCallback","createQueue","waitingList","elementsMap","WeakMap","isRunning","runWaitingList","deadline","hasTimeRemaining","timeRemaining","length","nextElement","shift","callback","get","delete","add","element","item","has","push","set","flush","index","indexOf","splice","reset"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,mBAAP,MAAgC,yBAAhC;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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,GAAG,MAAM;AAChC;AACA,MAAIC,WAAW,GAAG,EAAlB;AAEA;;AACA,MAAIC,WAAW,GAAG,IAAIC,OAAJ,EAAlB;AAEA,MAAIC,SAAS,GAAG,KAAhB;AAEA;AACD;AACA;AACA;AACA;AACA;;AACC,QAAMC,cAAc,GAAKC,QAAF,IAAgB;AACtC,UAAMC,gBAAgB,GACrB,OAAOD,QAAP,KAAoB,QAApB,GACG,MAAM,KADT,GAEG,MAAMA,QAAQ,CAACE,aAAT,KAA2B,CAHrC;;AAKA,OAAG;AACF,UAAKP,WAAW,CAACQ,MAAZ,KAAuB,CAA5B,EAAgC;AAC/BL,QAAAA,SAAS,GAAG,KAAZ;AACA;AACA;;AAED,YAAMM,WAAW;AAAG;AAAwCT,MAAAA,WAAW,CAACU,KAAZ,EAA5D;AACA,YAAMC,QAAQ;AAAG;AAAyCV,MAAAA,WAAW,CAACW,GAAZ,CACzDH,WADyD,CAA1D,CAPE,CAUF;AACA;AACA;;AACAE,MAAAA,QAAQ;AACRV,MAAAA,WAAW,CAACY,MAAZ,CAAoBJ,WAApB;AACA,KAfD,QAeUH,gBAAgB,EAf1B;;AAiBAR,IAAAA,mBAAmB,CAAEM,cAAF,CAAnB;AACA,GAxBD;AA0BA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;;AACC,QAAMU,GAAG,GAAG,CAAEC,OAAF,EAAWC,IAAX,KAAqB;AAChC,QAAK,CAAEf,WAAW,CAACgB,GAAZ,CAAiBF,OAAjB,CAAP,EAAoC;AACnCf,MAAAA,WAAW,CAACkB,IAAZ,CAAkBH,OAAlB;AACA;;AACDd,IAAAA,WAAW,CAACkB,GAAZ,CAAiBJ,OAAjB,EAA0BC,IAA1B;;AACA,QAAK,CAAEb,SAAP,EAAmB;AAClBA,MAAAA,SAAS,GAAG,IAAZ;AACAL,MAAAA,mBAAmB,CAAEM,cAAF,CAAnB;AACA;AACD,GATD;AAWA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACC,QAAMgB,KAAK,GAAKL,OAAF,IAAe;AAC5B,QAAK,CAAEd,WAAW,CAACgB,GAAZ,CAAiBF,OAAjB,CAAP,EAAoC;AACnC,aAAO,KAAP;AACA;;AAED,UAAMM,KAAK,GAAGrB,WAAW,CAACsB,OAAZ,CAAqBP,OAArB,CAAd;AACAf,IAAAA,WAAW,CAACuB,MAAZ,CAAoBF,KAApB,EAA2B,CAA3B;AACA,UAAMV,QAAQ;AAAG;AAAyCV,IAAAA,WAAW,CAACW,GAAZ,CACzDG,OADyD,CAA1D;AAGAd,IAAAA,WAAW,CAACY,MAAZ,CAAoBE,OAApB;AACAJ,IAAAA,QAAQ;AAER,WAAO,IAAP;AACA,GAdD;AAgBA;AACD;AACA;AACA;AACA;;;AACC,QAAMa,KAAK,GAAG,MAAM;
|
|
1
|
+
{"version":3,"sources":["@wordpress/priority-queue/src/index.js"],"names":["requestIdleCallback","createQueue","waitingList","elementsMap","WeakMap","isRunning","runWaitingList","deadline","hasTimeRemaining","timeRemaining","length","nextElement","shift","callback","get","delete","add","element","item","has","push","set","flush","index","indexOf","splice","cancel","reset"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,mBAAP,MAAgC,yBAAhC;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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,GAAG,MAAM;AAChC;AACA,MAAIC,WAAW,GAAG,EAAlB;AAEA;;AACA,MAAIC,WAAW,GAAG,IAAIC,OAAJ,EAAlB;AAEA,MAAIC,SAAS,GAAG,KAAhB;AAEA;AACD;AACA;AACA;AACA;AACA;;AACC,QAAMC,cAAc,GAAKC,QAAF,IAAgB;AACtC,UAAMC,gBAAgB,GACrB,OAAOD,QAAP,KAAoB,QAApB,GACG,MAAM,KADT,GAEG,MAAMA,QAAQ,CAACE,aAAT,KAA2B,CAHrC;;AAKA,OAAG;AACF,UAAKP,WAAW,CAACQ,MAAZ,KAAuB,CAA5B,EAAgC;AAC/BL,QAAAA,SAAS,GAAG,KAAZ;AACA;AACA;;AAED,YAAMM,WAAW;AAAG;AAAwCT,MAAAA,WAAW,CAACU,KAAZ,EAA5D;AACA,YAAMC,QAAQ;AAAG;AAAyCV,MAAAA,WAAW,CAACW,GAAZ,CACzDH,WADyD,CAA1D,CAPE,CAUF;AACA;AACA;;AACAE,MAAAA,QAAQ;AACRV,MAAAA,WAAW,CAACY,MAAZ,CAAoBJ,WAApB;AACA,KAfD,QAeUH,gBAAgB,EAf1B;;AAiBAR,IAAAA,mBAAmB,CAAEM,cAA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,EAA2B,CAA3B;AACApB,IAAAA,WAAW,CAACY,MAAZ,CAAoBE,OAApB;AAEA,WAAO,IAAP;AACA,GAVD;AAYA;AACD;AACA;AACA;AACA;;;AACC,QAAMU,KAAK,GAAG,MAAM;AACnBzB,IAAAA,WAAW,GAAG,EAAd;AACAC,IAAAA,WAAW,GAAG,IAAIC,OAAJ,EAAd;AACAC,IAAAA,SAAS,GAAG,KAAZ;AACA,GAJD;;AAMA,SAAO;AACNW,IAAAA,GADM;AAENM,IAAAA,KAFM;AAGNI,IAAAA,MAHM;AAINC,IAAAA;AAJM,GAAP;AAMA,CA9HM","sourcesContent":["/**\n * Internal dependencies\n */\nimport requestIdleCallback from './request-idle-callback';\n\n/**\n * Enqueued callback to invoke once idle time permits.\n *\n * @typedef {()=>void} WPPriorityQueueCallback\n */\n\n/**\n * An object used to associate callbacks in a particular context grouping.\n *\n * @typedef {{}} WPPriorityQueueContext\n */\n\n/**\n * Function to add callback to priority queue.\n *\n * @typedef {(element:WPPriorityQueueContext,item:WPPriorityQueueCallback)=>void} WPPriorityQueueAdd\n */\n\n/**\n * Function to flush callbacks from priority queue.\n *\n * @typedef {(element:WPPriorityQueueContext)=>boolean} WPPriorityQueueFlush\n */\n\n/**\n * Reset the queue.\n *\n * @typedef {()=>void} WPPriorityQueueReset\n */\n\n/**\n * Priority queue instance.\n *\n * @typedef {Object} WPPriorityQueue\n *\n * @property {WPPriorityQueueAdd} add Add callback to queue for context.\n * @property {WPPriorityQueueFlush} flush Flush queue for context.\n * @property {WPPriorityQueueFlush} cancel Clear queue for context.\n * @property {WPPriorityQueueReset} reset Reset queue.\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 = () => {\n\t/** @type {WPPriorityQueueContext[]} */\n\tlet waitingList = [];\n\n\t/** @type {WeakMap<WPPriorityQueueContext,WPPriorityQueueCallback>} */\n\tlet elementsMap = new WeakMap();\n\n\tlet isRunning = false;\n\n\t/**\n\t * Callback to process as much queue as time permits.\n\t *\n\t * @param {IdleDeadline|number} deadline Idle callback deadline object, or\n\t * animation frame timestamp.\n\t */\n\tconst runWaitingList = ( deadline ) => {\n\t\tconst hasTimeRemaining =\n\t\t\ttypeof deadline === 'number'\n\t\t\t\t? () => false\n\t\t\t\t: () => deadline.timeRemaining() > 0;\n\n\t\tdo {\n\t\t\tif ( waitingList.length === 0 ) {\n\t\t\t\tisRunning = false;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextElement = /** @type {WPPriorityQueueContext} */ ( waitingList.shift() );\n\t\t\tconst callback = /** @type {WPPriorityQueueCallback} */ ( elementsMap.get(\n\t\t\t\tnextElement\n\t\t\t) );\n\t\t\t// If errors with undefined callbacks are encountered double check that all of your useSelect calls\n\t\t\t// have all dependecies set correctly in second parameter. Missing dependencies can cause unexpected\n\t\t\t// loops and race conditions in the queue.\n\t\t\tcallback();\n\t\t\telementsMap.delete( nextElement );\n\t\t} while ( hasTimeRemaining() );\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 * @type {WPPriorityQueueAdd}\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t * @param {WPPriorityQueueCallback} item Callback function.\n\t */\n\tconst add = ( element, item ) => {\n\t\tif ( ! elementsMap.has( element ) ) {\n\t\t\twaitingList.push( element );\n\t\t}\n\t\telementsMap.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 * @type {WPPriorityQueueFlush}\n\t *\n\t * @param {WPPriorityQueueContext} element Context object.\n\t *\n\t * @return {boolean} Whether flush was performed.\n\t */\n\tconst flush = ( element ) => {\n\t\tif ( ! elementsMap.has( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst index = waitingList.indexOf( element );\n\t\twaitingList.splice( index, 1 );\n\t\tconst callback = /** @type {WPPriorityQueueCallback} */ ( elementsMap.get(\n\t\t\telement\n\t\t) );\n\t\telementsMap.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 * @type {WPPriorityQueueFlush}\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 = ( element ) => {\n\t\tif ( ! elementsMap.has( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst index = waitingList.indexOf( element );\n\t\twaitingList.splice( index, 1 );\n\t\telementsMap.delete( element );\n\n\t\treturn true;\n\t};\n\n\t/**\n\t * Reset the queue without running the pending callbacks.\n\t *\n\t * @type {WPPriorityQueueReset}\n\t */\n\tconst reset = () => {\n\t\twaitingList = [];\n\t\telementsMap = new WeakMap();\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"]}
|
package/build-types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAoEO,+BAFK,eAAe,CAgI1B;;;;sCA1LY,MAAI,IAAI;;;;qCAMR,EAAE;;;;2CAMO,sBAAsB,QAAM,uBAAuB,KAAG,IAAI;;;;6CAM1D,sBAAsB,KAAG,OAAO;;;;mCAMzC,MAAI,IAAI;;;;;;;;SAQP,kBAAkB;;;;WAClB,oBAAoB;;;;YACpB,oBAAoB;;;;WACpB,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/priority-queue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Generic browser priority queue.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
|
|
37
37
|
}
|
package/src/index.js
CHANGED
|
@@ -38,9 +38,10 @@ import requestIdleCallback from './request-idle-callback';
|
|
|
38
38
|
*
|
|
39
39
|
* @typedef {Object} WPPriorityQueue
|
|
40
40
|
*
|
|
41
|
-
* @property {WPPriorityQueueAdd} add
|
|
42
|
-
* @property {WPPriorityQueueFlush} flush
|
|
43
|
-
* @property {
|
|
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.
|
|
44
45
|
*/
|
|
45
46
|
|
|
46
47
|
/**
|
|
@@ -151,6 +152,29 @@ export const createQueue = () => {
|
|
|
151
152
|
return true;
|
|
152
153
|
};
|
|
153
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Clears the queue for a given context, cancelling the callbacks without
|
|
157
|
+
* executing them. Returns `true` if there were scheduled callbacks to cancel,
|
|
158
|
+
* or `false` if there was is no queue for the given context.
|
|
159
|
+
*
|
|
160
|
+
* @type {WPPriorityQueueFlush}
|
|
161
|
+
*
|
|
162
|
+
* @param {WPPriorityQueueContext} element Context object.
|
|
163
|
+
*
|
|
164
|
+
* @return {boolean} Whether any callbacks got cancelled.
|
|
165
|
+
*/
|
|
166
|
+
const cancel = ( element ) => {
|
|
167
|
+
if ( ! elementsMap.has( element ) ) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const index = waitingList.indexOf( element );
|
|
172
|
+
waitingList.splice( index, 1 );
|
|
173
|
+
elementsMap.delete( element );
|
|
174
|
+
|
|
175
|
+
return true;
|
|
176
|
+
};
|
|
177
|
+
|
|
154
178
|
/**
|
|
155
179
|
* Reset the queue without running the pending callbacks.
|
|
156
180
|
*
|
|
@@ -165,6 +189,7 @@ export const createQueue = () => {
|
|
|
165
189
|
return {
|
|
166
190
|
add,
|
|
167
191
|
flush,
|
|
192
|
+
cancel,
|
|
168
193
|
reset,
|
|
169
194
|
};
|
|
170
195
|
};
|
package/src/test/index.js
CHANGED
|
@@ -128,4 +128,31 @@ describe( 'createQueue', () => {
|
|
|
128
128
|
expect( callbackElementB ).toHaveBeenCalledTimes( 1 );
|
|
129
129
|
} );
|
|
130
130
|
} );
|
|
131
|
+
|
|
132
|
+
describe( 'cancel', () => {
|
|
133
|
+
it( 'removes all callbacks associated with element without executing', () => {
|
|
134
|
+
const elementA = {};
|
|
135
|
+
const elementB = {};
|
|
136
|
+
const callbackElementA = jest.fn();
|
|
137
|
+
const callbackElementB = jest.fn();
|
|
138
|
+
queue.add( elementA, callbackElementA );
|
|
139
|
+
queue.add( elementB, callbackElementB );
|
|
140
|
+
|
|
141
|
+
expect( callbackElementA ).not.toHaveBeenCalled();
|
|
142
|
+
expect( callbackElementB ).not.toHaveBeenCalled();
|
|
143
|
+
|
|
144
|
+
expect( queue.cancel( elementA ) ).toBe( true );
|
|
145
|
+
|
|
146
|
+
// No callbacks should have been called.
|
|
147
|
+
expect( callbackElementA ).not.toHaveBeenCalled();
|
|
148
|
+
expect( callbackElementB ).not.toHaveBeenCalled();
|
|
149
|
+
|
|
150
|
+
// A subsequent `flush` has nothing to remove.
|
|
151
|
+
expect( queue.flush( elementA ) ).toBe( false );
|
|
152
|
+
|
|
153
|
+
// The queue for `elementA` remained intact and can be successfully flushed.
|
|
154
|
+
expect( queue.flush( elementB ) ).toBe( true );
|
|
155
|
+
expect( callbackElementB ).toHaveBeenCalledTimes( 1 );
|
|
156
|
+
} );
|
|
157
|
+
} );
|
|
131
158
|
} );
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"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.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.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.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.es2020.bigint.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.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.esnext.intl.d.ts","./src/request-idle-callback.js","./src/index.js","../../node_modules/@types/requestidlecallback/index.d.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"78e8bcd74d07239f0301d11024c1a21adfad1f8836775fada144e53da950c82d","
|
|
1
|
+
{"program":{"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.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.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.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.es2020.bigint.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.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.esnext.intl.d.ts","./src/request-idle-callback.js","./src/index.js","../../node_modules/@types/requestidlecallback/index.d.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"78e8bcd74d07239f0301d11024c1a21adfad1f8836775fada144e53da950c82d","997d37a1bcedbf95d459aacf334f11e36bdc09309dc21a44b661e10f968c1fab",{"version":"9b66eb641b8ff1824e4d04022ba1a051c5c10746ea94147b24c2f5e27c5f9c88","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[45]],"referencedMap":[[46,1]],"exportedModulesMap":[[46,1]],"semanticDiagnosticsPerFile":[47,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,46,45]},"version":"4.4.2"}
|