Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

BaseAudioMuteButton.ts 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { IconMic, IconMicSlash } from '../../icons/svg';
  2. import AbstractButton, { IProps } from './AbstractButton';
  3. /**
  4. * An abstract implementation of a button for toggling audio mute.
  5. */
  6. export default class BaseAudioMuteButton<P extends IProps, S=any>
  7. extends AbstractButton<P, S> {
  8. icon = IconMic;
  9. toggledIcon = IconMicSlash;
  10. /**
  11. * Handles clicking / pressing the button, and toggles the audio mute state
  12. * accordingly.
  13. *
  14. * @override
  15. * @protected
  16. * @returns {void}
  17. */
  18. _handleClick() {
  19. this._setAudioMuted(!this._isAudioMuted());
  20. }
  21. /**
  22. * Helper function to be implemented by subclasses, which must return a
  23. * boolean value indicating if audio is muted or not.
  24. *
  25. * @protected
  26. * @returns {boolean}
  27. */
  28. _isAudioMuted() {
  29. // To be implemented by subclass.
  30. return false;
  31. }
  32. /**
  33. * Indicates whether this button is in toggled state or not.
  34. *
  35. * @override
  36. * @protected
  37. * @returns {boolean}
  38. */
  39. _isToggled() {
  40. return this._isAudioMuted();
  41. }
  42. /**
  43. * Helper function to perform the actual setting of the audio mute / unmute
  44. * action.
  45. *
  46. * @param {boolean} _audioMuted - Whether audio should be muted or not.
  47. * @protected
  48. * @returns {void}
  49. */
  50. _setAudioMuted(_audioMuted: boolean) {
  51. // To be implemented by subclass.
  52. }
  53. }