Skip to content

Commit db69d93

Browse files
committed
chore: add JSDoc comments
1 parent f5a369f commit db69d93

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/javascript/src/addons/longTasks.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ interface LoAFEntry extends PerformanceEntry {
6363
}[];
6464
}
6565

66+
/**
67+
* Check whether the browser supports a given PerformanceObserver entry type
68+
*
69+
* @param type - entry type name, e.g. `'longtask'` or `'long-animation-frame'`
70+
*/
6671
function supportsEntryType(type: string): boolean {
6772
try {
6873
return (
@@ -75,6 +80,11 @@ function supportsEntryType(type: string): boolean {
7580
}
7681
}
7782

83+
/**
84+
* Subscribe to Long Tasks (>50 ms) via PerformanceObserver
85+
*
86+
* @param onEntry - callback fired for each detected long task
87+
*/
7888
function observeLongTasks(onEntry: (e: LongTaskEvent) => void): void {
7989
if (!supportsEntryType('longtask')) {
8090
log('Long Tasks API is not supported in this browser', 'info');
@@ -100,6 +110,12 @@ function observeLongTasks(onEntry: (e: LongTaskEvent) => void): void {
100110
} catch { /* unsupported — ignore */ }
101111
}
102112

113+
/**
114+
* Subscribe to Long Animation Frames (>50 ms) via PerformanceObserver.
115+
* Provides script-level attribution (Chrome 123+, Edge 123+).
116+
*
117+
* @param onEntry - callback fired for each detected LoAF entry
118+
*/
103119
function observeLoAF(onEntry: (e: LongTaskEvent) => void): void {
104120
if (!supportsEntryType('long-animation-frame')) {
105121
log('Long Animation Frames (LoAF) API is not supported in this browser', 'info');

0 commit comments

Comments
 (0)