The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/startup/callbacks.ts

25 lines
693 B

import { performance } from 'universal-perf-hooks';
import { callbacks } from '../../lib/callbacks';
import { getConfig } from '../lib/utils/getConfig';
if ([getConfig('debug'), getConfig('timed-callbacks')].includes('true')) {
callbacks.setMetricsTrackers({
trackCallback: ({ hook, id, stack }) => {
const start = performance.now();
return (): void => {
const end = performance.now();
console.log(String(end - start), hook, id, stack?.split('\n')?.[2]?.match(/\(.+\)/)?.[0]);
};
},
trackHook: ({ hook }) => {
const start = performance.now();
return (): void => {
const end = performance.now();
console.log(`${hook}:`, end - start);
};
},
});
}