modified lib-jitsi-meet dev repo
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.

index.js 1.4KB

123456789101112131415161718192021222324252627282930
  1. const ljm = require('./JitsiMeetJS').default;
  2. /**
  3. * Tries to deal with the following problem: {@code JitsiMeetJS} is not only
  4. * this module, it's also a global (i.e. attached to {@code window}) namespace
  5. * for all globals of the projects in the Jitsi Meet family. If lib-jitsi-meet
  6. * is loaded through an HTML {@code script} tag, {@code JitsiMeetJS} will
  7. * automatically be attached to {@code window} by webpack. Unfortunately,
  8. * webpack's source code does not check whether the global variable has already
  9. * been assigned and overwrites it. Which is OK for the module
  10. * {@code JitsiMeetJS} but is not OK for the namespace {@code JitsiMeetJS}
  11. * because it may already contain the values of other projects in the Jitsi Meet
  12. * family. The solution offered here works around webpack by merging all
  13. * existing values of the namespace {@code JitsiMeetJS} into the module
  14. * {@code JitsiMeetJS}.
  15. *
  16. * @param {Object} module - The module {@code JitsiMeetJS} (which will be
  17. * exported and may be attached to {@code window} by webpack later on).
  18. * @private
  19. * @returns {Object} - A {@code JitsiMeetJS} module which contains all existing
  20. * value of the namespace {@code JitsiMeetJS} (if any).
  21. */
  22. function _mergeNamespaceAndModule(module) {
  23. return (
  24. typeof window.JitsiMeetJS === 'object'
  25. ? Object.assign({}, window.JitsiMeetJS, module)
  26. : module);
  27. }
  28. module.exports = _mergeNamespaceAndModule(ljm);