zone-patch-message-port.js 660 B

1234567891011121314151617181920
  1. 'use strict';
  2. /**
  3. * @license Angular v<unknown>
  4. * (c) 2010-2025 Google LLC. https://angular.io/
  5. * License: MIT
  6. */
  7. function patchMessagePort(Zone) {
  8. /**
  9. * Monkey patch `MessagePort.prototype.onmessage` and `MessagePort.prototype.onmessageerror`
  10. * properties to make the callback in the zone when the value are set.
  11. */
  12. Zone.__load_patch('MessagePort', (global, Zone, api) => {
  13. const MessagePort = global['MessagePort'];
  14. if (typeof MessagePort !== 'undefined' && MessagePort.prototype) {
  15. api.patchOnProperties(MessagePort.prototype, ['message', 'messageerror']);
  16. }
  17. });
  18. }
  19. patchMessagePort(Zone);