[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('ResizeObserver', function (global, Zone, api) {
|
---|
| 20 | var ResizeObserver = global['ResizeObserver'];
|
---|
| 21 | if (!ResizeObserver) {
|
---|
| 22 | return;
|
---|
| 23 | }
|
---|
| 24 | var resizeObserverSymbol = api.symbol('ResizeObserver');
|
---|
| 25 | api.patchMethod(global, 'ResizeObserver', function (delegate) { return function (self, args) {
|
---|
| 26 | var callback = args.length > 0 ? args[0] : null;
|
---|
| 27 | if (callback) {
|
---|
| 28 | args[0] = function (entries, observer) {
|
---|
| 29 | var _this = this;
|
---|
| 30 | var zones = {};
|
---|
| 31 | var currZone = Zone.current;
|
---|
| 32 | for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
---|
| 33 | var entry = entries_1[_i];
|
---|
| 34 | var zone = entry.target[resizeObserverSymbol];
|
---|
| 35 | if (!zone) {
|
---|
| 36 | zone = currZone;
|
---|
| 37 | }
|
---|
| 38 | var zoneEntriesInfo = zones[zone.name];
|
---|
| 39 | if (!zoneEntriesInfo) {
|
---|
| 40 | zones[zone.name] = zoneEntriesInfo = { entries: [], zone: zone };
|
---|
| 41 | }
|
---|
| 42 | zoneEntriesInfo.entries.push(entry);
|
---|
| 43 | }
|
---|
| 44 | Object.keys(zones).forEach(function (zoneName) {
|
---|
| 45 | var zoneEntriesInfo = zones[zoneName];
|
---|
| 46 | if (zoneEntriesInfo.zone !== Zone.current) {
|
---|
| 47 | zoneEntriesInfo.zone.run(callback, _this, [zoneEntriesInfo.entries, observer], 'ResizeObserver');
|
---|
| 48 | }
|
---|
| 49 | else {
|
---|
| 50 | callback.call(_this, zoneEntriesInfo.entries, observer);
|
---|
| 51 | }
|
---|
| 52 | });
|
---|
| 53 | };
|
---|
| 54 | }
|
---|
| 55 | return args.length > 0 ? new ResizeObserver(args[0]) : new ResizeObserver();
|
---|
| 56 | }; });
|
---|
| 57 | api.patchMethod(ResizeObserver.prototype, 'observe', function (delegate) { return function (self, args) {
|
---|
| 58 | var target = args.length > 0 ? args[0] : null;
|
---|
| 59 | if (!target) {
|
---|
| 60 | return delegate.apply(self, args);
|
---|
| 61 | }
|
---|
| 62 | var targets = self[resizeObserverSymbol];
|
---|
| 63 | if (!targets) {
|
---|
| 64 | targets = self[resizeObserverSymbol] = [];
|
---|
| 65 | }
|
---|
| 66 | targets.push(target);
|
---|
| 67 | target[resizeObserverSymbol] = Zone.current;
|
---|
| 68 | return delegate.apply(self, args);
|
---|
| 69 | }; });
|
---|
| 70 | api.patchMethod(ResizeObserver.prototype, 'unobserve', function (delegate) { return function (self, args) {
|
---|
| 71 | var target = args.length > 0 ? args[0] : null;
|
---|
| 72 | if (!target) {
|
---|
| 73 | return delegate.apply(self, args);
|
---|
| 74 | }
|
---|
| 75 | var targets = self[resizeObserverSymbol];
|
---|
| 76 | if (targets) {
|
---|
| 77 | for (var i = 0; i < targets.length; i++) {
|
---|
| 78 | if (targets[i] === target) {
|
---|
| 79 | targets.splice(i, 1);
|
---|
| 80 | break;
|
---|
| 81 | }
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 | target[resizeObserverSymbol] = undefined;
|
---|
| 85 | return delegate.apply(self, args);
|
---|
| 86 | }; });
|
---|
| 87 | api.patchMethod(ResizeObserver.prototype, 'disconnect', function (delegate) { return function (self, args) {
|
---|
| 88 | var targets = self[resizeObserverSymbol];
|
---|
| 89 | if (targets) {
|
---|
| 90 | targets.forEach(function (target) {
|
---|
| 91 | target[resizeObserverSymbol] = undefined;
|
---|
| 92 | });
|
---|
| 93 | self[resizeObserverSymbol] = undefined;
|
---|
| 94 | }
|
---|
| 95 | return delegate.apply(self, args);
|
---|
| 96 | }; });
|
---|
| 97 | });
|
---|
| 98 | })));
|
---|