-2
I’m having a weird problem in my javascript, when I run in the pc browser works normal, but when I run in the mobile browser javascript does not recognize my functions/variables.
class UusarioDAO{
static async trazDadosUsuario(id){
const dados = await
firebase.database().ref("usuarios/"+id).once("value");
usuario.setUsuarioId(dados.val().usuarioId);
usuario.setNome(dados.val().nome);
usuario.setPais(dados.val().pais);
usuario.setFoto(dados.val().foto);
usuario.setEmail(dados.val().email);
usuario.setFotoProvedor(dados.val().fotoProvedor);
usuario.setCaminho(dados.val().caminho);
usuario.setToken(dados.val().token);
usuario.setUsuarioGostos(dados.val().gostos);
pais = dados.val().pais;
return new Promise((resolve,reject)=>resolve("resolvido"));
}
}
class EventoDAO{
static async listar(id){
let eventos = [];
const eventosRef = firebase.database().ref("eventos/"+pais);
try{
const user = await userRef.once("value");
const categorias = await eventosRef.once("value");
categorias.forEach(auxEvento=>{
const evento = new Evento();
evento.setId(auxEventos.val().id);
evento.setTitulo(auxEventos.val().titulo);
evento.setDescricao(auxEventos.val().descricao);
evento.setHorario(auxEventos.val().horario);
eventos.push(evento);
});
return new Promise((resolve,reject)=>resolve(eventos));
}catch(erro){
console.log(erro);
Notificacao.erro(erro);
}
}
}
try{
await UsuarioDAO.trazDadosUsuario(user.uid,null);
const eventos = await EventoDAO.listar(user.uid);
escondeLoading()
eventos.forEach(evento=>{
criaLista(evento,"todos");
});
defineLanguage();
if(navigator.language.split("-").shift()=="en"){
$(".btn-success").css("padding","30px 30px");
$(".btn-primary").css("padding","30px 8px");
}
}catch(erro){
console.log(erro);
Notificacao.erro(erro);
}
}
you have defined the class name Uusariodao and are using Usuariodao, you realize that there is a
u
the most– Marconi
It was a mistake just here in question. in my code not so ta not, but the problem is that it works in the normal browser, but when I try by mobile will not. the link if you want to test on your https://apptcc-6f556.firebasepp.com/eventos.html
– Izaac Mendes
It’s not a weird problem, rs. What happens is that you are using newer javascript features without before building in the stable version. In short, you are utilizing
class
as if it were something standard in all browsers, but unfortunately it is not yet. If you want something crossbrowser, you will need to transpose your code with Babel or some other Compiler. Abs– Diogo Lessa
did not understand, because I tested on pc Chrome and cell phone Chrome also, but it did not work
– Izaac Mendes