1 | 'use strict';
|
---|
2 | /**
|
---|
3 | * @license Angular v12.0.0-next.0
|
---|
4 | * (c) 2010-2020 Google LLC. https://angular.io/
|
---|
5 | * License: MIT
|
---|
6 | */
|
---|
7 | /**
|
---|
8 | * @license
|
---|
9 | * Copyright Google LLC All Rights Reserved.
|
---|
10 | *
|
---|
11 | * Use of this source code is governed by an MIT-style license that can be
|
---|
12 | * found in the LICENSE file at https://angular.io/license
|
---|
13 | */
|
---|
14 | Zone.__load_patch('cordova', (global, Zone, api) => {
|
---|
15 | if (global.cordova) {
|
---|
16 | const SUCCESS_SOURCE = 'cordova.exec.success';
|
---|
17 | const ERROR_SOURCE = 'cordova.exec.error';
|
---|
18 | const FUNCTION = 'function';
|
---|
19 | const nativeExec = api.patchMethod(global.cordova, 'exec', () => function (self, args) {
|
---|
20 | if (args.length > 0 && typeof args[0] === FUNCTION) {
|
---|
21 | args[0] = Zone.current.wrap(args[0], SUCCESS_SOURCE);
|
---|
22 | }
|
---|
23 | if (args.length > 1 && typeof args[1] === FUNCTION) {
|
---|
24 | args[1] = Zone.current.wrap(args[1], ERROR_SOURCE);
|
---|
25 | }
|
---|
26 | return nativeExec.apply(self, args);
|
---|
27 | });
|
---|
28 | }
|
---|
29 | });
|
---|
30 | Zone.__load_patch('cordova.FileReader', (global, Zone) => {
|
---|
31 | if (global.cordova && typeof global['FileReader'] !== 'undefined') {
|
---|
32 | document.addEventListener('deviceReady', () => {
|
---|
33 | const FileReader = global['FileReader'];
|
---|
34 | ['abort', 'error', 'load', 'loadstart', 'loadend', 'progress'].forEach(prop => {
|
---|
35 | const eventNameSymbol = Zone.__symbol__('ON_PROPERTY' + prop);
|
---|
36 | Object.defineProperty(FileReader.prototype, eventNameSymbol, {
|
---|
37 | configurable: true,
|
---|
38 | get: function () {
|
---|
39 | return this._realReader && this._realReader[eventNameSymbol];
|
---|
40 | }
|
---|
41 | });
|
---|
42 | });
|
---|
43 | });
|
---|
44 | }
|
---|
45 | });
|
---|