Skip to content

Commit d753806

Browse files
authored
Merge pull request #1190 from chintan9/coderabbitai/docstrings/b0306c0
📝 Add docstrings to `tsdown`
2 parents b0306c0 + 7381385 commit d753806

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

example/plyr-example/src/App.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const youtubeVideoSrc = {
1414
],
1515
};
1616

17+
/**
18+
* Root React component that renders a heading and a Plyr video player configured with `youtubeVideoSrc`.
19+
*
20+
* @returns {JSX.Element} The app UI containing a header and the Plyr player.
21+
*/
1722
function App() {
1823
const ref = useRef(null);
1924

src/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ const getAPI: GetAPI<PlyrInstance, PlyrConfigurationProps> = (
7171
});
7272
};
7373

74+
/**
75+
* Connects a video element ref to a Plyr instance and exposes a forwarded API ref.
76+
*
77+
* Initializes and manages the Plyr lifecycle using the provided `params`. The returned ref
78+
* should be attached to the underlying <video> element; the forwarded `ref` receives an
79+
* API object (shape: { plyr: PlyrInstance }) that is safe to use from parent components.
80+
*
81+
* @param params - Configuration for the Plyr instance: `source` (media source or null) and
82+
* `options` (Plyr options or null). Changes to these values will reconfigure the player.
83+
* @param deps - Optional dependency list controlling when the underlying aptor logic runs.
84+
* If `null`, defaults to [params.options, params.source].
85+
* @returns A ref to attach to the <video> element that Plyr will control.
86+
*/
7487
export function usePlyr(
7588
ref: Ref<APITypes>,
7689
params: PlyrConfigurationProps,

0 commit comments

Comments
 (0)