zone-patch-socket-io.js 897 B

1234567891011121314151617181920212223
  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('socketio', (global, Zone, api) => {
  8. Zone[Zone.__symbol__('socketio')] = function patchSocketIO(io) {
  9. // patch io.Socket.prototype event listener related method
  10. api.patchEventTarget(global, api, [io.Socket.prototype], {
  11. useG: false,
  12. chkDup: false,
  13. rt: true,
  14. diff: (task, delegate) => {
  15. return task.callback === delegate;
  16. }
  17. });
  18. // also patch io.Socket.prototype.on/off/removeListener/removeAllListeners
  19. io.Socket.prototype.on = io.Socket.prototype.addEventListener;
  20. io.Socket.prototype.off = io.Socket.prototype.removeListener =
  21. io.Socket.prototype.removeAllListeners = io.Socket.prototype.removeEventListener;
  22. };
  23. });