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

192
Vistas
How can this function which has undefined argument be able to run?

In https://stackoverflow.com/a/44795246/3416774, the essence of the code is:

network.on("afterDrawing", function (ctx) {
    var dataURL = ctx.canvas.toDataURL();
    document.getElementById('canvasImg').src = dataURL;
});

How can it run? ctx isn't defined anywhere. In the Vis.js' documentation, the afterDrawing event has this description:

Name Properties Description
afterDrawing canvas context Fired after drawing on the canvas has been completed. Can be used to draw on top of the network.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

ctx is short for canvas context. So when the method on() completes, it will return the canvas context so the function can pick up. This is a concept called callback functions.

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