Skip to content

Commit

Permalink
Use destructuring assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
tvanlaerhoven committed Jan 21, 2025
1 parent 8751a16 commit cd0a80a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ui/components/hooks/useCurrentTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TIME_CHANGE_EVENTS = [PlayerEventType.TIME_UPDATE, PlayerEventType.SEEKING
* @group Hooks
*/
export const useCurrentTime = () => {
const player = useContext(PlayerContext).player;
const { player } = useContext(PlayerContext);
const subscribe = useCallback(
(callback: () => void) => {
TIME_CHANGE_EVENTS.forEach((event) => player?.addEventListener(event, callback));
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/hooks/useDuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const DURATION_CHANGE_EVENTS = [PlayerEventType.LOADED_DATA, PlayerEventType.DUR
* @group Hooks
*/
export const useDuration = () => {
const player = useContext(PlayerContext).player;
const { player } = useContext(PlayerContext);
const subscribe = useCallback(
(callback: () => void) => {
DURATION_CHANGE_EVENTS.forEach((event) => player?.addEventListener(event, callback));
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/hooks/useSeekable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { PlayerEventType, type TimeRange, ProgressEvent } from 'react-native-the
* @group Hooks
*/
export const useSeekable = () => {
const player = useContext(PlayerContext).player;
const { player } = useContext(PlayerContext);
const [seekable, setSeekable] = useState<TimeRange[]>([]);
useEffect(() => {
const onUpdateSeekable = (event: ProgressEvent) => {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/hooks/useThumbnailTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const TEXT_TRACK_CHANGE_EVENTS = [PlayerEventType.LOADED_DATA, PlayerEventType.T
* @group Hooks
*/
export const useThumbnailTrack = () => {
const player = useContext(PlayerContext).player;
const { player } = useContext(PlayerContext);
const subscribe = useCallback(
(callback: () => void) => {
TEXT_TRACK_CHANGE_EVENTS.forEach((event) => player?.addEventListener(event, callback));
Expand Down

0 comments on commit cd0a80a

Please sign in to comment.