mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
Update syntax and fix timing of async functions
This commit is contained in:
@@ -10,9 +10,14 @@ function gradioApp() {
|
||||
}
|
||||
|
||||
function logFn(func) {
|
||||
return async function () { // eslint-disable-line func-names
|
||||
return async (...args) => {
|
||||
const t0 = performance.now();
|
||||
const returnValue = func(...arguments);
|
||||
let returnValue;
|
||||
if (func.constructor.name.toLowerCase() === 'asyncfunction') {
|
||||
returnValue = await func(...args);
|
||||
} else {
|
||||
returnValue = func(...args);
|
||||
}
|
||||
const t1 = performance.now();
|
||||
log(func.name, `time=${Math.round(t1 - t0)}`);
|
||||
return returnValue;
|
||||
|
||||
Reference in New Issue
Block a user