Files
Bubberstation/tgui/packages/tgui-panel/audio/hooks.ts
2023-12-09 23:49:30 -05:00

18 lines
365 B
TypeScript

/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { useSelector, useDispatch } from 'tgui/backend';
import { selectAudio } from './selectors';
export const useAudio = () => {
const state = useSelector(selectAudio);
const dispatch = useDispatch();
return {
...state,
toggle: () => dispatch({ type: 'audio/toggle' }),
};
};