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.

ConferenceUrl.js 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { redirect } from '../util/helpers';
  2. /**
  3. * Stores the original conference room URL with all parameters.
  4. * @type {string}
  5. */
  6. let originalURL;
  7. /**
  8. * A simplified version of the conference URL stripped out of the parameters
  9. * which should be used for sending invites.
  10. * @type {string}
  11. */
  12. let inviteURL;
  13. /**
  14. * The modules stores information about the URL used to start the conference and
  15. * provides utility methods for dealing with conference URL and reloads.
  16. */
  17. export default {
  18. /**
  19. * Initializes the module.
  20. *
  21. * @param location an object which stores provides the info about conference
  22. * URL(would be 'window.location' for the Web app). The params below are
  23. * described based on the following example URL:
  24. *
  25. * https://example.com:8888/SomeConference1245?opt=1#somehash
  26. *
  27. * @param location.href full URL with all parameters, would be the whole URL
  28. * from the example string above.
  29. *
  30. * @param location.host the host part of the URL, 'example.com' from
  31. * the sample URL above.
  32. *
  33. * @param location.pathname the path part of the URL, would be
  34. * '/SomeConference1245' from the example above.
  35. *
  36. * @param location.protocol the protocol part of the URL, would be 'https:'
  37. * from the sample URL.
  38. */
  39. init(location) {
  40. originalURL = location.href;
  41. // "https:" + "//" + "example.com:8888" + "/SomeConference1245"
  42. inviteURL
  43. = location.protocol + "//" + location.host + location.pathname;
  44. console.info("Stored original conference URL: " + originalURL);
  45. console.info("Conference URL for invites: " + inviteURL);
  46. },
  47. /**
  48. * Obtains the conference invite URL.
  49. * @return {string} the URL pointing o the conference which is mean to be
  50. * used to invite new participants.
  51. */
  52. getInviteUrl() {
  53. return inviteURL;
  54. },
  55. /**
  56. * Obtains full conference URL with all original parameters.
  57. * @return {string} the original URL used to open the current conference.
  58. */
  59. getOriginalUrl() {
  60. return originalURL;
  61. },
  62. /**
  63. * Reloads the conference using original URL with all of the parameters.
  64. */
  65. reload() {
  66. console.info("Reloading the conference using URL: " + originalURL);
  67. redirect(originalURL);
  68. }
  69. };