* Sets content of given bucket and propagates it through the pipe. * @param {number[]|string|Uint8Array|Chain} content * @param {number} [bucket=0] Bucket index * @param {Brick} [sender=null] Sender brick or null * @return Fluent interface
(content, bucket = 0, sender = null)
| 491 | * @return Fluent interface |
| 492 | */ |
| 493 | setContent (content, bucket = 0, sender = null) { |
| 494 | // Wrap content inside Chain |
| 495 | content = Chain.wrap(content) |
| 496 | |
| 497 | // Stop here, if no changes are being applied |
| 498 | if (this.getContent(bucket, false).isEqualTo(content)) { |
| 499 | return this |
| 500 | } |
| 501 | |
| 502 | // Update bucket content |
| 503 | this._bucketContent[bucket] = content |
| 504 | |
| 505 | // Select the last changed bucket |
| 506 | if (sender === null || sender instanceof Viewer) { |
| 507 | this._selectedBucket = bucket |
| 508 | } |
| 509 | |
| 510 | // Propagate changes through pipe |
| 511 | this._propagateContent(bucket, sender) |
| 512 | return this |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * Propagate content through pipe from given bucket. |
no test coverage detected