()
| 222 | } |
| 223 | |
| 224 | private _loadApi() { |
| 225 | if (this.hasLoaded) { |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | if (!apiLoadingPromise) { |
| 230 | apiLoadingPromise = this._loadScript( |
| 231 | 'https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js', |
| 232 | ); |
| 233 | } |
| 234 | |
| 235 | apiLoadingPromise.then( |
| 236 | () => { |
| 237 | this.hasLoaded = true; |
| 238 | this.cdr.markForCheck(); |
| 239 | }, |
| 240 | error => console.error('Failed to load Google Maps API', error), |
| 241 | ); |
| 242 | } |
| 243 | |
| 244 | private _loadScript(url: string): Promise<unknown> { |
| 245 | return new Promise((resolve, reject) => { |
no test coverage detected