webapis-rtc-peer-connection.js 938 B

123456789101112131415161718192021
  1. 'use strict';
  2. /**
  3. * @license Angular v<unknown>
  4. * (c) 2010-2022 Google LLC. https://angular.io/
  5. * License: MIT
  6. */
  7. Zone.__load_patch('RTCPeerConnection', (global, Zone, api) => {
  8. const RTCPeerConnection = global['RTCPeerConnection'];
  9. if (!RTCPeerConnection) {
  10. return;
  11. }
  12. const addSymbol = api.symbol('addEventListener');
  13. const removeSymbol = api.symbol('removeEventListener');
  14. RTCPeerConnection.prototype.addEventListener = RTCPeerConnection.prototype[addSymbol];
  15. RTCPeerConnection.prototype.removeEventListener = RTCPeerConnection.prototype[removeSymbol];
  16. // RTCPeerConnection extends EventTarget, so we must clear the symbol
  17. // to allow patch RTCPeerConnection.prototype.addEventListener again
  18. RTCPeerConnection.prototype[addSymbol] = null;
  19. RTCPeerConnection.prototype[removeSymbol] = null;
  20. api.patchEventTarget(global, api, [RTCPeerConnection.prototype], { useG: false });
  21. });