blob: ddb53611f81ea6e1faf5b980cb2bc1cf495d1195 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
class GenomeList {
constructor(elt) {
this.genomes = [];
this.elt = elt
}
push(genome) {
this.genomes.push(genome)
const li = document.createElement('li')
li.appendChild(genome.elt)
this.historyElt.appendChild(li)
genome.elt.scrollIntoView(false)
}
get last() {
if (this.genomes.length > 0) {
return this.genomes[this.genomes.length - 1]
} else {
return undefined
}
}
get historyElt() {
if (this._historyElt === undefined) {
this._historyElt = document.createElement('ol')
this.elt.querySelector('.history').appendChild(this._historyElt)
}
return this._historyElt
}
set initialGenome(genome) {
this.initialElt.appendChild(genome.elt)
}
set finalGenome(genome) {
this.finalElt.appendChild(genome.elt)
this.finalElt.classList.remove('hidden')
}
get initialElt() {
return this.elt.querySelector('.initial')
}
get finalElt() {
return this.elt.querySelector('.final')
}
}
export default GenomeList
|