source: trip-planner-front/node_modules/zone.js/bundles/zone-bluebird.umd.js@ ceaed42

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

initial commit

  • Property mode set to 100644
File size: 4.3 KB
Line 
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('bluebird', function (global, Zone, api) {
20 // TODO: @JiaLiPassion, we can automatically patch bluebird
21 // if global.Promise = Bluebird, but sometimes in nodejs,
22 // global.Promise is not Bluebird, and Bluebird is just be
23 // used by other libraries such as sequelize, so I think it is
24 // safe to just expose a method to patch Bluebird explicitly
25 var BLUEBIRD = 'bluebird';
26 Zone[Zone.__symbol__(BLUEBIRD)] = function patchBluebird(Bluebird) {
27 // patch method of Bluebird.prototype which not using `then` internally
28 var bluebirdApis = ['then', 'spread', 'finally'];
29 bluebirdApis.forEach(function (bapi) {
30 api.patchMethod(Bluebird.prototype, bapi, function (delegate) { return function (self, args) {
31 var zone = Zone.current;
32 var _loop_1 = function (i) {
33 var func = args[i];
34 if (typeof func === 'function') {
35 args[i] = function () {
36 var argSelf = this;
37 var argArgs = arguments;
38 return new Bluebird(function (res, rej) {
39 zone.scheduleMicroTask('Promise.then', function () {
40 try {
41 res(func.apply(argSelf, argArgs));
42 }
43 catch (error) {
44 rej(error);
45 }
46 });
47 });
48 };
49 }
50 };
51 for (var i = 0; i < args.length; i++) {
52 _loop_1(i);
53 }
54 return delegate.apply(self, args);
55 }; });
56 });
57 if (typeof window !== 'undefined') {
58 window.addEventListener('unhandledrejection', function (event) {
59 var error = event.detail && event.detail.reason;
60 if (error && error.isHandledByZone) {
61 event.preventDefault();
62 if (typeof event.stopImmediatePropagation === 'function') {
63 event.stopImmediatePropagation();
64 }
65 }
66 });
67 }
68 else if (typeof process !== 'undefined') {
69 process.on('unhandledRejection', function (reason, p) {
70 if (reason && reason.isHandledByZone) {
71 var listeners_1 = process.listeners('unhandledRejection');
72 if (listeners_1) {
73 // remove unhandledRejection listeners so the callback
74 // will not be triggered.
75 process.removeAllListeners('unhandledRejection');
76 process.nextTick(function () {
77 listeners_1.forEach(function (listener) { return process.on('unhandledRejection', listener); });
78 });
79 }
80 }
81 });
82 }
83 Bluebird.onPossiblyUnhandledRejection(function (e, promise) {
84 try {
85 Zone.current.runGuarded(function () {
86 e.isHandledByZone = true;
87 throw e;
88 });
89 }
90 catch (err) {
91 err.isHandledByZone = false;
92 api.onUnhandledError(err);
93 }
94 });
95 // override global promise
96 global.Promise = Bluebird;
97 };
98 });
99})));
Note: See TracBrowser for help on using the repository browser.