webapis-rtc-peer-connection.ts 1021 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @license
  3. * Copyright Google Inc. All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. Zone.__load_patch('RTCPeerConnection', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
  9. const RTCPeerConnection = global['RTCPeerConnection'];
  10. if (!RTCPeerConnection) {
  11. return;
  12. }
  13. const addSymbol = api.symbol('addEventListener');
  14. const removeSymbol = api.symbol('removeEventListener');
  15. RTCPeerConnection.prototype.addEventListener = RTCPeerConnection.prototype[addSymbol];
  16. RTCPeerConnection.prototype.removeEventListener = RTCPeerConnection.prototype[removeSymbol];
  17. // RTCPeerConnection extends EventTarget, so we must clear the symbol
  18. // to allow patch RTCPeerConnection.prototype.addEventListener again
  19. RTCPeerConnection.prototype[addSymbol] = null;
  20. RTCPeerConnection.prototype[removeSymbol] = null;
  21. api.patchEventTarget(global, [RTCPeerConnection.prototype], {useG: false});
  22. });