You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractHangupButton.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // @flow
  2. import { Component } from 'react';
  3. import {
  4. createToolbarEvent,
  5. sendAnalytics
  6. } from '../../../analytics';
  7. /**
  8. * An abstract implementation of a button for leaving the conference.
  9. */
  10. export default class AbstractHangupButton extends Component<*> {
  11. /**
  12. * Initializes a new {@code AbstractHangupButton} instance.
  13. *
  14. * @param {Props} props - The read-only React {@code Component} props with
  15. * which the new instance is to be initialized.
  16. */
  17. constructor(props: Object) {
  18. super(props);
  19. // Bind event handler so it is only bound once per instance.
  20. this._onToolbarHangup = this._onToolbarHangup.bind(this);
  21. }
  22. /**
  23. * Dispatches an action for leaving the current conference.
  24. *
  25. * @private
  26. * @returns {void}
  27. */
  28. _doHangup() {
  29. /* to be implemented by descendants */
  30. }
  31. _onToolbarHangup: () => void;
  32. /**
  33. * Creates an analytics toolbar event and dispatches an action for leaving
  34. * the current conference.
  35. *
  36. * @private
  37. * @returns {void}
  38. */
  39. _onToolbarHangup() {
  40. sendAnalytics(createToolbarEvent('hangup'));
  41. this._doHangup();
  42. }
  43. }