Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secão 2 - aula 12.C07 Adicionando evento click -ERRO #6

Open
Walter-Paiva opened this issue May 11, 2020 · 4 comments
Open

Secão 2 - aula 12.C07 Adicionando evento click -ERRO #6

Walter-Paiva opened this issue May 11, 2020 · 4 comments

Comments

@Walter-Paiva
Copy link

class CalcController {
constructor(){
this._locale = 'pt-BR';
this._displayCalcEl = document.querySelector("#display");
this._timeEl = document.querySelector("#hora");
this._dateEl = document.querySelector("#data");
this._currentDate;
this.initialize();
this.initButtonsEvents();

}
  
initialize(){

    setInterval(()=>{
        this.displayDate = this.currentDate.toLocaleDateString(this._locale);
        this.displayTime = this.currentDate.toLocaleTimeString(this._locale);
    }, 1000);    

}

addEventListenerAll(element, events, fn){
     events.split(' ').forEach(event =>{
         element.addEvenrListener(event, fn, false);
     });
}

initButtonsEvents(){
    let buttons = document.querySelectorAll("#buttons > g, #parts > g");
    buttons.forEach((btn, index)=>{
        this.addEventListenerAll(btn, "click drag mouseover", e =>{
            console.log(btn.className.baseVal.replace("btn-",""));
        })
    })
}
get displayTime(){
    return this._timeEl.innerHTML;
}
set displayTime(value){
    return this._timeEl.innerHTML = value;
}

get displayDate(){
    return this._dateEl.innerHTML;
}
set displayDate(value){
    return this._dateEl.innerHTML = value;
}

get displayCalc(){
    return this._displayCalcEl.innerHTML;
}
set displayCalc(value){
    this._displayCalcEl.innerHTML = value;
}
get currentDate(){
    return new Date();
}
set currentDate(value){
    this._currentDate = value;
}

}

@Walter-Paiva
Copy link
Author

Não acho o erro !!

@TierryBr
Copy link

Também o meu da erro no click, mas é no split dizendo que não é uma função, já resolveu ?

@Walter-Paiva
Copy link
Author

sim

@silvadias
Copy link

Fala.. a linha 6 onde esta #dados
this._dateEl = document.querySelector ("# dados");
escreva se =>-> this._dateEl = document.querySelector ("# data");
image

Agarrei na 14 e não sai nem pro Rai, revi o código esta tudo ok, parece até que editaram o vídeo e esqueceram de algo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants