Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
los mensajes de registro de la consola no se muestran en la consola del navegador

Tengo esta función en mi vista de Backbone para crear un nuevo objeto a través de una API en el backend:

 // *** called when remote hardware signal triggered createConference: function () { var self = this; console.log("ScheduleLocationArea.js - createConference() ") const startTime = performance.now(); this.sysLocation.create().then((response) => { self.model.collection.add(response); }); const duration = performance.now() - startTime; console.log(`PERFORMANACE CHECK: ScheduleLocationArea.js - the function createConference() took ${duration}ms`); },

Está llamando a esta función:

 // called from within createConference async create() { console.log("Location.js - create() ") const startTime = performance.now(); return await this.sync('create', this, { url: this.create.url(this.id) }, { silent: true }); const duration = performance.now() - startTime; console.log(`PERFORMANACE CHECK: Location.js - the function create() took ${duration}ms`); },

Como puede ver, estoy tratando de comprobar los problemas de rendimiento.

Pero por alguna razón que no puedo entender, no está finalizando la función create() . Nunca veo la PERFORMANACE CHECK para esa función.

Aquí está la salida de mi consola:

 ScheduleLocationArea.js - createConference() Location.js:22 Location.js - create() ScheduleLocationArea.js:269 PERFORMANACE CHECK: ScheduleLocationArea.js - the function createConference() took 1.7000000476837158ms

El navegador escribe todos los mensajes de la consola anteriores muy rápido.

Y aunque dice que solo tardó 1,7 ms... en realidad tarda unos 3 segundos.

Así que no puedo entender por qué está tardando tanto y por qué no está escribiendo los números de rendimiento para la función create() .

¿Hay algo que estoy haciendo mal?

¡Gracias!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Está regresando de su función antes de llamar a console.log en su primer fragmento. Cualquier código que sigue a una declaración de devolución no se ejecuta:

 // called from within createConference async create() { console.log("Location.js - create() ") const startTime = performance.now(); return await this.sync('create', this, { url: this.create.url(this.id) }, { silent: true }); // this following code never runs as screate(0 has returned already const duration = performance.now() - startTime; console.log(`PERFORMANACE CHECK: Location.js - the function create() took ${duration}ms`); },
about 4 years ago · Juan Pablo Isaza Report

0

Cambia tu código de:

 // called from within createConference async create() { console.log("Location.js - create() ") const startTime = performance.now(); return await this.sync('create', this, { url: this.create.url(this.id) }, { silent: true }); const duration = performance.now() - startTime; console.log(`PERFORMANACE CHECK: Location.js - the function create() took ${duration}ms`); },

a

 // called from within createConference async create() { console.log("Location.js - create() ") const startTime = performance.now(); const newUrl = await this.sync('create', this, { url: this.create.url(this.id) }, { silent: true }); const duration = performance.now() - startTime; console.log(`PERFORMANACE CHECK: Location.js - the function create() took ${duration}ms`); return newUrl; },

Esto permitirá que su función muestre los registros de rendimiento antes de devolver el valor creado.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!