/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/google-maps/map-base-layer.ts
47 строк
1 KB
Kristiyan Kostadinov
fix(multiple): remove empty constructors (#33048)
08 апр 2026, 22:21
Не верифицирован
08 апр 2026, 22:21
ce4c2c0
Код
Авторство
О чём код?
/** * @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 */ import {Directive, NgZone, OnDestroy, OnInit, inject} from '@angular/core'; import {GoogleMap} from './google-map/google-map'; @Directive({ selector: 'map-base-layer', exportAs: 'mapBaseLayer', }) export class MapBaseLayer implements OnInit, OnDestroy { protected readonly _map = inject(GoogleMap); protected readonly _ngZone = inject(NgZone); ngOnInit() { if (this._map._isBrowser) { this._ngZone.runOutsideAngular(() => { this._initializeObject(); }); this._assertInitialized(); this._setMap(); } } ngOnDestroy() { this._unsetMap(); } private _assertInitialized() { if (!this._map.googleMap) { throw Error( 'Cannot access Google Map information before the API has been initialized. ' + 'Please wait for the API to load before trying to interact with it.', ); } } protected _initializeObject() {} protected _setMap() {} protected _unsetMap() {} }