custom-elements.ts 655 B

12345678910111213141516171819
  1. /**
  2. * @license
  3. * Copyright Google Inc. All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. export function patchCustomElements(_global: any, api: _ZonePrivate) {
  9. const {isBrowser, isMix} = api.getGlobalObjects()!;
  10. if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) {
  11. return;
  12. }
  13. const callbacks =
  14. ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];
  15. api.patchCallbacks(api, _global.customElements, 'customElements', 'define', callbacks);
  16. }