angular/packages/zone.js/lib/browser/custom-elements.ts
Joey Perrott 9dbe6fc18b refactor: update license text to point to angular.dev (#57901)
Update license text to point to angular.dev instead of angular.io

PR Close #57901
2024-09-24 15:33:00 +02:00

28 lines
904 B
TypeScript

/**
* @license
* Copyright Google LLC 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.dev/license
*/
export function patchCustomElements(_global: any, api: _ZonePrivate) {
const {isBrowser, isMix} = api.getGlobalObjects()!;
if ((!isBrowser && !isMix) || !_global['customElements'] || !('customElements' in _global)) {
return;
}
// https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-lifecycle-callbacks
const callbacks = [
'connectedCallback',
'disconnectedCallback',
'adoptedCallback',
'attributeChangedCallback',
'formAssociatedCallback',
'formDisabledCallback',
'formResetCallback',
'formStateRestoreCallback',
];
api.patchCallbacks(api, _global.customElements, 'customElements', 'define', callbacks);
}