INNER CODE UNIT · JavaScript
generatePostHook
cyrus-and/chrome-har-capturer · bin/cli.js:93
function generatePostHook(userMetric) {
return async (url, client) => {
// allow the user specified grace time
await new Promise((fulfill, reject) => {
setTimeout(fulfill, program.grace || 0);
});
// allow to add the output of user-provided code to the HAR
let user;
if (userMetric) {
const {result, exceptionDetails} = await client.Runtime.evaluate({
expression: userMetric,
returnByValue: true,
awaitPromise: true,
});
// return the result or the error message
if (exceptionDetails) {
user = exceptionDetails.exception.description;
} else {