* Appends new items to the list-value. \ * Dispatches a new copy of the value, without mutating the current-value. * * It only works if the Unit is not frozen, and at least 1 item is provided. * * @param items The items to be appended to the list. * @returns The new length
(...items: Item[])
| 428 | * @category Customised Array.prototype |
| 429 | */ |
| 430 | push(...items: Item[]): number { |
| 431 | if (this.isFrozen || !items.length) { |
| 432 | return this.length; |
| 433 | } |
| 434 | this.checkSerializabilityMaybe(items); |
| 435 | |
| 436 | const listShallowCopy = [...this.rawValue()]; |
| 437 | const newLength = listShallowCopy.push(...this.deepCopyMaybe(items)); |
| 438 | this.updateValueAndCache(listShallowCopy); |
| 439 | |
| 440 | if (this.eventsSubject?.observers.length && !this.isMuted) { |
| 441 | this.eventsSubject.next(new EventListUnitPush(items)); |
| 442 | } |
| 443 | return newLength; |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * Removes the last item from the list-{@link value} and returns it. \ |
no test coverage detected