|
289 | 289 | * @category Callback |
290 | 290 | */ |
291 | 291 | /// TableCallback |
| 292 | +/** |
| 293 | + * The TableCellCallback type describes a function that takes a Cell's Id and |
| 294 | + * the count of times it appears across a whole Table. |
| 295 | + * |
| 296 | + * A TableCellCallback is provided when using the forEachTableCell method, so |
| 297 | + * that you can do something based on every Cell used across a Table. See that |
| 298 | + * method for specific examples. |
| 299 | + * |
| 300 | + * @param cellId The Id of the Cell that the callback can operate on. |
| 301 | + * @param count The number of times this Cell is used across a whole Table. |
| 302 | + * @category Callback |
| 303 | + */ |
| 304 | +/// TableCellCallback |
292 | 305 | /** |
293 | 306 | * The RowCallback type describes a function that takes a Row's Id and a |
294 | 307 | * callback to loop over each Cell within it. |
|
3189 | 3202 | * @category Iterator |
3190 | 3203 | */ |
3191 | 3204 | /// Store.forEachTable |
| 3205 | + /** |
| 3206 | + * The forEachTableCell method takes a function that it will then call for |
| 3207 | + * each Cell used across the whole Table. |
| 3208 | + * |
| 3209 | + * This method is useful for iterating over the Cell structure of the Table in |
| 3210 | + * a functional style. The `tableCellCallback` parameter is a |
| 3211 | + * TableCellCallback function that will be called with the Id of each Cell and |
| 3212 | + * the count of Rows in the Table in which it appears. |
| 3213 | + * |
| 3214 | + * @param tableId The Id of the Table containing the Cells to iterate over. |
| 3215 | + * @param tableCellCallback The function that should be called for every Cell |
| 3216 | + * Id used across the whole Table. |
| 3217 | + * @example |
| 3218 | + * This example iterates over each Cell Id used across the whole Table. |
| 3219 | + * |
| 3220 | + * ```js |
| 3221 | + * const store = createStore().setTables({ |
| 3222 | + * pets: {fido: {species: 'dog'}, felix: {species: 'cat', legs: 4}}, |
| 3223 | + * }); |
| 3224 | + * store.forEachTableCell('pets', (cellId, count) => { |
| 3225 | + * console.log(`${cellId}: ${count}`); |
| 3226 | + * }); |
| 3227 | + * // -> 'species: 2' |
| 3228 | + * // -> 'legs: 1' |
| 3229 | + * ``` |
| 3230 | + * @category Iterator |
| 3231 | + * @since v3.3 |
| 3232 | + */ |
| 3233 | + /// Store.forEachTableCell |
3192 | 3234 | /** |
3193 | 3235 | * The forEachRow method takes a function that it will then call for each Row |
3194 | 3236 | * in a specified Table. |
|
0 commit comments