* Returns content of given bucket. * @param {number} [bucket=0] Bucket index * @param {boolean} [waitForCompletion=true] If set to true, the value is * being resolved after all pipe tasks have been completed. * @throws {Error} If bucket index is out of bounds. * @return {Chain|Promise
(bucket = 0, waitForCompletion = true)
| 472 | * @return {Chain|Promise} content |
| 473 | */ |
| 474 | getContent (bucket = 0, waitForCompletion = true) { |
| 475 | if (bucket >= this._bucketContent.length) { |
| 476 | throw new Error(`Bucket index ${bucket} is out of bounds.`) |
| 477 | } |
| 478 | if (waitForCompletion && this.isBusy()) { |
| 479 | return new Promise((resolve, reject) => { |
| 480 | this._bucketListeners[bucket].push({ resolve, reject }) |
| 481 | }) |
| 482 | } |
| 483 | return this._bucketContent[bucket] |
| 484 | } |
| 485 | |
| 486 | /** |
| 487 | * Sets content of given bucket and propagates it through the pipe. |
no test coverage detected