[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('mediaQuery', function (global, Zone, api) {
|
---|
| 20 | function patchAddListener(proto) {
|
---|
| 21 | api.patchMethod(proto, 'addListener', function (delegate) { return function (self, args) {
|
---|
| 22 | var callback = args.length > 0 ? args[0] : null;
|
---|
| 23 | if (typeof callback === 'function') {
|
---|
| 24 | var wrapperedCallback = Zone.current.wrap(callback, 'MediaQuery');
|
---|
| 25 | callback[api.symbol('mediaQueryCallback')] = wrapperedCallback;
|
---|
| 26 | return delegate.call(self, wrapperedCallback);
|
---|
| 27 | }
|
---|
| 28 | else {
|
---|
| 29 | return delegate.apply(self, args);
|
---|
| 30 | }
|
---|
| 31 | }; });
|
---|
| 32 | }
|
---|
| 33 | function patchRemoveListener(proto) {
|
---|
| 34 | api.patchMethod(proto, 'removeListener', function (delegate) { return function (self, args) {
|
---|
| 35 | var callback = args.length > 0 ? args[0] : null;
|
---|
| 36 | if (typeof callback === 'function') {
|
---|
| 37 | var wrapperedCallback = callback[api.symbol('mediaQueryCallback')];
|
---|
| 38 | if (wrapperedCallback) {
|
---|
| 39 | return delegate.call(self, wrapperedCallback);
|
---|
| 40 | }
|
---|
| 41 | else {
|
---|
| 42 | return delegate.apply(self, args);
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
| 45 | else {
|
---|
| 46 | return delegate.apply(self, args);
|
---|
| 47 | }
|
---|
| 48 | }; });
|
---|
| 49 | }
|
---|
| 50 | if (global['MediaQueryList']) {
|
---|
| 51 | var proto = global['MediaQueryList'].prototype;
|
---|
| 52 | patchAddListener(proto);
|
---|
| 53 | patchRemoveListener(proto);
|
---|
| 54 | }
|
---|
| 55 | else if (global['matchMedia']) {
|
---|
| 56 | api.patchMethod(global, 'matchMedia', function (delegate) { return function (self, args) {
|
---|
| 57 | var mql = delegate.apply(self, args);
|
---|
| 58 | if (mql) {
|
---|
| 59 | // try to patch MediaQueryList.prototype
|
---|
| 60 | var proto = Object.getPrototypeOf(mql);
|
---|
| 61 | if (proto && proto['addListener']) {
|
---|
| 62 | // try to patch proto, don't need to worry about patch
|
---|
| 63 | // multiple times, because, api.patchEventTarget will check it
|
---|
| 64 | patchAddListener(proto);
|
---|
| 65 | patchRemoveListener(proto);
|
---|
| 66 | patchAddListener(mql);
|
---|
| 67 | patchRemoveListener(mql);
|
---|
| 68 | }
|
---|
| 69 | else if (mql['addListener']) {
|
---|
| 70 | // proto not exists, or proto has no addListener method
|
---|
| 71 | // try to patch mql instance
|
---|
| 72 | patchAddListener(mql);
|
---|
| 73 | patchRemoveListener(mql);
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 | return mql;
|
---|
| 77 | }; });
|
---|
| 78 | }
|
---|
| 79 | });
|
---|
| 80 | })));
|
---|