Not all browsers return the PerformanceEntry object on performance.measure(). Fix credit @JeLuf

This commit is contained in:
cmdr2 2023-01-10 10:01:24 +05:30 committed by GitHub
parent fb0c9405cf
commit 1da4b3d94a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -839,11 +839,10 @@
* @memberof Task
*/
async post(timeout=-1) {
if (typeof performance == "object" && performance.mark && performance.measure) {
performance.mark('make-render-request')
if (performance.getEntriesByName('click-makeImage', 'mark').length > 0) {
console.log('delay between clicking and making the server request:', performance.measure('diff', 'click-makeImage', 'make-render-request').duration + ' ms')
}
performance.mark('make-render-request')
if (performance.getEntriesByName('click-makeImage', 'mark').length > 0) {
performance.measure('diff', 'click-makeImage', 'make-render-request')
console.log('delay between clicking and making the server request:', performance.getEntriesByName('diff', 'measure')[0].duration + ' ms')
}
let jsonResponse = await super.post('/render', timeout)