UNPKG

@chainsafe/ssz

Version:
23 lines 790 B
import { ArrayCompositeTreeView } from "./arrayComposite.js"; export class ListCompositeTreeView extends ArrayCompositeTreeView { type; tree; constructor(type, tree) { super(type, tree); this.type = type; this.tree = tree; } /** * Adds one view element at the end of the array and adds 1 to the current Tree length. */ push(view) { const length = this.length; if (length >= this.type.limit) { throw Error("Error pushing over limit"); } this.type.tree_setLength(this.tree, length + 1); // No need for pre-initialization like in ListBasic.push since ArrayCompositeTreeView.set() doesn't do a get node this.set(length, view); } } //# sourceMappingURL=listComposite.js.map