mirror of
https://github.com/zoriya/v10.git
synced 2026-08-06 14:18:10 +00:00
10 lines
383 B
TypeScript
10 lines
383 B
TypeScript
import { getInitialSource, onSourceChange } from '@app/shared/sandbox-listener';
|
|
import type { SourceId } from '@app/shared/sources';
|
|
import { useEffect, useState } from 'react';
|
|
|
|
export function useSource(audioOnly?: boolean): SourceId {
|
|
const [source, setSource] = useState(() => getInitialSource(audioOnly));
|
|
useEffect(() => onSourceChange(setSource), []);
|
|
return source;
|
|
}
|