Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

functions.any.ts 631B

12345678910111213141516171819
  1. import { IReduxState } from '../../app/types';
  2. /**
  3. * Returns true if there are devices of a specific type or on native platform.
  4. *
  5. * @param {Object} state - The state of the application.
  6. * @param {string} type - The type of device: VideoOutput | audioOutput | audioInput.
  7. *
  8. * @returns {boolean}
  9. */
  10. export function hasAvailableDevices(state: IReduxState, type: string) {
  11. if (state['features/base/devices'] === undefined) {
  12. return true;
  13. }
  14. const availableDevices = state['features/base/devices'].availableDevices;
  15. return Number(availableDevices[type as keyof typeof availableDevices]?.length) > 0;
  16. }