source: trip-planner-front/node_modules/zone.js/bundles/zone-patch-jsonp.umd.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.7 KB
RevLine 
[6a3a178]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(function (factory) {
8 typeof define === 'function' && define.amd ? define(factory) :
9 factory();
10}((function () {
11 'use strict';
12 /**
13 * @license
14 * Copyright Google LLC All Rights Reserved.
15 *
16 * Use of this source code is governed by an MIT-style license that can be
17 * found in the LICENSE file at https://angular.io/license
18 */
19 Zone.__load_patch('jsonp', function (global, Zone, api) {
20 // because jsonp is not a standard api, there are a lot of
21 // implementations, so zone.js just provide a helper util to
22 // patch the jsonp send and onSuccess/onError callback
23 // the options is an object which contains
24 // - jsonp, the jsonp object which hold the send function
25 // - sendFuncName, the name of the send function
26 // - successFuncName, success func name
27 // - failedFuncName, failed func name
28 Zone[Zone.__symbol__('jsonp')] = function patchJsonp(options) {
29 if (!options || !options.jsonp || !options.sendFuncName) {
30 return;
31 }
32 var noop = function () { };
33 [options.successFuncName, options.failedFuncName].forEach(function (methodName) {
34 if (!methodName) {
35 return;
36 }
37 var oriFunc = global[methodName];
38 if (oriFunc) {
39 api.patchMethod(global, methodName, function (delegate) { return function (self, args) {
40 var task = global[api.symbol('jsonTask')];
41 if (task) {
42 task.callback = delegate;
43 return task.invoke.apply(self, args);
44 }
45 else {
46 return delegate.apply(self, args);
47 }
48 }; });
49 }
50 else {
51 Object.defineProperty(global, methodName, {
52 configurable: true,
53 enumerable: true,
54 get: function () {
55 return function () {
56 var task = global[api.symbol('jsonpTask')];
57 var delegate = global[api.symbol("jsonp" + methodName + "callback")];
58 if (task) {
59 if (delegate) {
60 task.callback = delegate;
61 }
62 global[api.symbol('jsonpTask')] = undefined;
63 return task.invoke.apply(this, arguments);
64 }
65 else {
66 if (delegate) {
67 return delegate.apply(this, arguments);
68 }
69 }
70 return null;
71 };
72 },
73 set: function (callback) {
74 this[api.symbol("jsonp" + methodName + "callback")] = callback;
75 }
76 });
77 }
78 });
79 api.patchMethod(options.jsonp, options.sendFuncName, function (delegate) { return function (self, args) {
80 global[api.symbol('jsonpTask')] =
81 Zone.current.scheduleMacroTask('jsonp', noop, {}, function (task) {
82 return delegate.apply(self, args);
83 }, noop);
84 }; });
85 };
86 });
87})));
Note: See TracBrowser for help on using the repository browser.