Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

305
Visualizações
'object promise' using eel and js

This is my js function:

async function get_days() {
    var events = await eel.get_events('ofek')();
    var eve = events[0]['event_name'];
    alert(eve);
    
    
    startPoint = new Date(year, month - 1, 1).getDay(); // 0=Sunday
    numberOfDaysInMonth = new Date(year, month, 0).getDate(); // setting the number of days in the current month
    numberOfDaysInPrevMonth = new Date(year, month - 1, 0).getDate(); // setting the number of days in the prev month
    content = "";
    for (j = 1; j <= startPoint; j++) {
        content += "<li class='prev_next'>" + (numberOfDaysInPrevMonth - startPoint + j) + "</li>";
    
    }
    for (i = 1; i <= numberOfDaysInMonth; i++){
        if (i == currentDate.getDate() && month == currentDate.getMonth() + 1 && year == currentDate.getFullYear()){
            content += "<li onclick='return open_create_event_screen();' class='active'>" + i + "</li>";
        }
        else if (i > currentDate.getDate() && month < currentDate.getMonth() + 1 && year == currentDate.getFullYear()) { // TODO
            content += "<li onclick='return open_create_event_screen();'>" + i + "</li>";
        }
        else { // if the date has already passed - no ability to create event
            content += "<li>" + i + "</li>";
        }
    }
    
    daysNextMonth = 7 - (new Date(year, month, 0).getDay() + 1);
    for (n = 1; n <= daysNextMonth; n++) {
        content += "<li class='prev_next'>" + n + "</li>";
    }
    
    daysDiv.innerHTML = content;
    document.getElementById("current_month").innerHTML = monthNames[month - 1];
    document.getElementById("current_year").innerHTML = year;
    }

This is my python function:

@eel.expose
def get_events(username):
    print("get_events")
    name_of_events = client.get_events(username)
    print(name_of_events)
    return name_of_events

The problem is on the first three lines in the function get_days():

var events = await eel.get_events('ofek')();
var eve = events[0]['event_name'];
alert(eve);

It doesn't succeed to get the value from the python function. If I put those three lines in another function, it succeed. But in this function it can't get the returned value. Does someone know why?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda