zone-patch-socket-io.umd.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. /**
  3. * @license Angular v<unknown>
  4. * (c) 2010-2025 Google LLC. https://angular.io/
  5. * License: MIT
  6. */
  7. (function (factory) {
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. factory();
  10. })((function () {
  11. 'use strict';
  12. function patchSocketIo(Zone) {
  13. Zone.__load_patch('socketio', function (global, Zone, api) {
  14. Zone[Zone.__symbol__('socketio')] = function patchSocketIO(io) {
  15. // patch io.Socket.prototype event listener related method
  16. api.patchEventTarget(global, api, [io.Socket.prototype], {
  17. useG: false,
  18. chkDup: false,
  19. rt: true,
  20. diff: function (task, delegate) {
  21. return task.callback === delegate;
  22. },
  23. });
  24. // also patch io.Socket.prototype.on/off/removeListener/removeAllListeners
  25. io.Socket.prototype.on = io.Socket.prototype.addEventListener;
  26. io.Socket.prototype.off =
  27. io.Socket.prototype.removeListener =
  28. io.Socket.prototype.removeAllListeners =
  29. io.Socket.prototype.removeEventListener;
  30. };
  31. });
  32. }
  33. patchSocketIo(Zone);
  34. }));