/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v21.2.13
src/google-maps/map-base-layer.ts
50 строк
1 KB
Joey Perrott
fix(google-maps): implicitly include google.maps types instead of the triple slash workaround (#30942)
25 апр 2025, 01:35
Не верифицирован
25 апр 2025, 01:35
cc61697
Код
Авторство
О чём код?
/** * @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); constructor(...args: unknown[]); constructor() {} 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() {} }