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.

getRoomName.js 825B

1234567891011121314151617181920212223242526272829
  1. /* @flow */
  2. declare var config: Object;
  3. /**
  4. * Builds and returns the room name.
  5. *
  6. * @returns {string}
  7. */
  8. export default function getRoomName(): ?string {
  9. const { getroomnode } = config;
  10. const path = window.location.pathname;
  11. let roomName;
  12. // Determine the room node from the URL.
  13. if (getroomnode && typeof getroomnode === 'function') {
  14. roomName = getroomnode.call(config, path);
  15. } else {
  16. // Fall back to the default strategy of making assumptions about how the
  17. // URL maps to the room (name). It currently assumes a deployment in
  18. // which the last non-directory component of the path (name) is the
  19. // room.
  20. roomName
  21. = path.substring(path.lastIndexOf('/') + 1).toLowerCase()
  22. || undefined;
  23. }
  24. return roomName;
  25. }