Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
Electron javascript only working when devtools is open

I have a program that utilizes electron and puppeteer. When the user scrolls down to the bottom of the electron application page puppeteer gets triggered to scroll down in order to load more list items that sequentially get loaded onto the electron application page. On one html electron page the script works. It uses a function to load in 10 items, adds a scroll event listener which when triggered will use the aforementioned function to load in ten more. But on a different html electron page, using the same function it will load in ten different items, add the scroll event listener and attempt to keep try loading in ten more as the user scrolls. The issue is it loads in the first ten and then fails to load in the other ones when the user scrolls to the bottom, unless the dev tools is open in the electron app. I've tested it by creating alert windows when the user scrolls, so I know that the event listener is being properly appended to the document. I receive no error in the console because it works when the console is open.

Containers.js

let lastContainer, maxScrollY = getMaxScrollY(), loading = false, newPage = true, songData; //These reset after a new page has loaded 

const createContainers = (page, createContainer) => {
    const conPerCycle = 10;

    containers(conPerCycle, createContainer, page); // Initial Loader; Loads data, creates container, adds data to container

    document.addEventListener('scroll', (e) => {
        if (Math.floor(window.scrollY) == maxScrollY && !loading) {
            newPage = false;
            containers(conPerCycle, createContainer, page); // Triggered Loader; Loads data, creates container, adds data to container
        }
    });
}; 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Math.floor(window.scrollY) did not equal maxScrollY, it was one pixel less because I was using Math.floor, changed it to Math.ceil and it started working, case closed!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda