您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Settings.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. var email = '';
  2. var displayName = '';
  3. var userId;
  4. function supportsLocalStorage() {
  5. try {
  6. return 'localStorage' in window && window.localStorage !== null;
  7. } catch (e) {
  8. console.log("localstorage is not supported");
  9. return false;
  10. }
  11. }
  12. function generateUniqueId() {
  13. function _p8() {
  14. return (Math.random().toString(16) + "000000000").substr(2, 8);
  15. }
  16. return _p8() + _p8() + _p8() + _p8();
  17. }
  18. if (supportsLocalStorage()) {
  19. if (!window.localStorage.jitsiMeetId) {
  20. window.localStorage.jitsiMeetId = generateUniqueId();
  21. console.log("generated id", window.localStorage.jitsiMeetId);
  22. }
  23. userId = window.localStorage.jitsiMeetId || '';
  24. email = window.localStorage.email || '';
  25. displayName = window.localStorage.displayname || '';
  26. } else {
  27. console.log("local storage is not supported");
  28. userId = generateUniqueId();
  29. }
  30. var Settings =
  31. {
  32. setDisplayName: function (newDisplayName) {
  33. displayName = newDisplayName;
  34. window.localStorage.displayname = displayName;
  35. return displayName;
  36. },
  37. setEmail: function (newEmail)
  38. {
  39. email = newEmail;
  40. window.localStorage.email = newEmail;
  41. return email;
  42. },
  43. getSettings: function () {
  44. return {
  45. email: email,
  46. displayName: displayName,
  47. uid: userId
  48. };
  49. }
  50. };
  51. module.exports = Settings;