- Notifications
You must be signed in to change notification settings - Fork 6.8k
/
Copy pathmap-base-layer.ts
50 lines (42 loc) · 1.19 KB
/
map-base-layer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @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',
})
exportclassMapBaseLayerimplementsOnInit,OnDestroy{
protectedreadonly_map=inject(GoogleMap);
protectedreadonly_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){
throwError(
'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(){}
}