zone-patch-cordova.umd.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. /**
  3. * @license Angular v<unknown>
  4. * (c) 2010-2022 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. Zone.__load_patch('cordova', function (global, Zone, api) {
  13. if (global.cordova) {
  14. var SUCCESS_SOURCE_1 = 'cordova.exec.success';
  15. var ERROR_SOURCE_1 = 'cordova.exec.error';
  16. var FUNCTION_1 = 'function';
  17. var nativeExec_1 = api.patchMethod(global.cordova, 'exec', function () { return function (self, args) {
  18. if (args.length > 0 && typeof args[0] === FUNCTION_1) {
  19. args[0] = Zone.current.wrap(args[0], SUCCESS_SOURCE_1);
  20. }
  21. if (args.length > 1 && typeof args[1] === FUNCTION_1) {
  22. args[1] = Zone.current.wrap(args[1], ERROR_SOURCE_1);
  23. }
  24. return nativeExec_1.apply(self, args);
  25. }; });
  26. }
  27. });
  28. Zone.__load_patch('cordova.FileReader', function (global, Zone) {
  29. if (global.cordova && typeof global['FileReader'] !== 'undefined') {
  30. document.addEventListener('deviceReady', function () {
  31. var FileReader = global['FileReader'];
  32. ['abort', 'error', 'load', 'loadstart', 'loadend', 'progress'].forEach(function (prop) {
  33. var eventNameSymbol = Zone.__symbol__('ON_PROPERTY' + prop);
  34. Object.defineProperty(FileReader.prototype, eventNameSymbol, {
  35. configurable: true,
  36. get: function () {
  37. return this._realReader && this._realReader[eventNameSymbol];
  38. }
  39. });
  40. });
  41. });
  42. }
  43. });
  44. }));