Skip to content

Commit

Permalink
refactor: github-workflow to autogenerate docs from codebase's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rukhsarkh committed Jan 1, 2025
1 parent 861757b commit 7b63a16
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: feature/admin-docs-refactor # Explicitly checkout your feature branch
ref: feature/admin-docs-refactor

- name: Setup Node.js
uses: actions/setup-node@v2
Expand Down
19 changes: 16 additions & 3 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
import { promises } from 'dns';
import type { MetricType } from 'web-vitals';

/**
* Reports web performance metrics to the console.
*
* @param {Function} [onPerfEntry] - Optional callback function
* that will be called with the metric object for each metric.
* The function should have the following signature:
* (metric: MetricType) => void
*/
const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void): void => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ onCLS, onFCP, onLCP, onTTFB }) => {
// Reports the CLS (Cumulative Layout Shift) metric.
onCLS(onPerfEntry);

// Reports the FCP (First Contentful Paint) metric.
onFCP(onPerfEntry);

// Reports the LCP (Largest Contentful Paint) metric.
onLCP(onPerfEntry);

// Reports the TTFB (Time to First Byte) metric.
onTTFB(onPerfEntry);
});
}
};

export default reportWebVitals;

0 comments on commit 7b63a16

Please sign in to comment.