Forráskód Böngészése

[chunkedForEach]: add jsdoc

mightyplow 7 éve
szülő
commit
b16192f97c
1 módosított fájl, 9 hozzáadás és 0 törlés
  1. 9 0
      src/array/chunkedForEach.js

+ 9 - 0
src/array/chunkedForEach.js

@@ -16,6 +16,15 @@ const mkExecNextMessage = (values, fn, resolve, chunkSize, msg) => function exec
 
 const createSplitMessage = () => `FOR_EACH_SPLIT_${Math.floor(Math.random() * 10000)}`;
 
+/**
+ * Splits an array into chunks and breaks the execution queue to ensure reactivity.
+ *
+ * @memberOf array
+ * @param {Array} ar
+ * @param {function} fn
+ * @param {number} chunkSize
+ * @return {Promise}
+ */
 const chunkedForEach = (ar = [], fn = Function.prototype, chunkSize = 1) => {
     checkArray(ar);
     if (!$postMessage) { throw Error('postMessage not available'); }