2019-05-31 11:56:07 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
|
|
|
export function patchCustomElements(_global: any, api: _ZonePrivate) {
|
2020-04-13 19:40:21 -04:00
|
|
|
const {isBrowser, isMix} = api.getGlobalObjects()!;
|
2019-05-31 11:56:07 -04:00
|
|
|
if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const callbacks =
|
|
|
|
['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];
|
|
|
|
|
|
|
|
api.patchCallbacks(api, _global.customElements, 'customElements', 'define', callbacks);
|
|
|
|
}
|