34 lines
No EOL
894 B
JavaScript
34 lines
No EOL
894 B
JavaScript
class Element{
|
|
constructor(techno,tag) {
|
|
this.tag = tag
|
|
this.techno = techno
|
|
}
|
|
|
|
chargerDepuisBdd(){
|
|
fetch("../bdd/arbre.json").then((data)=>{
|
|
data.json().then((data)=>{
|
|
this.props = data["technologies"][this.techno]["elements"][this.tag]
|
|
this.cout = this.props.cout
|
|
this.nom = this.props.nom
|
|
this.boost = this.props.boost
|
|
})
|
|
|
|
})
|
|
}
|
|
|
|
afficherDropsDansHtml(){
|
|
const table= document.getElementById("table_technologies_body")
|
|
|
|
const tr = document.createElement("tr")
|
|
const nom = document.createElement("td")
|
|
nom.innerText = this.nom
|
|
const boost = document.createElement("td")
|
|
boost.innerText = this.boost
|
|
|
|
tr.appendChild(nom)
|
|
tr.appendChild(boost)
|
|
table.appendChild(tr)
|
|
|
|
}
|
|
|
|
} |