@@ -244,7 +244,7 @@ export class DeprecatedMapMarkerClusterer
244
244
return new MarkerClusterer ( map , [ ] , this . _combineOptions ( ) ) ;
245
245
} ) ;
246
246
247
- this . _assertInitialized ( ) ;
247
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
248
248
this . _eventManager . setTarget ( this . markerClusterer ) ;
249
249
this . markerClustererInitialized . emit ( this . markerClusterer ) ;
250
250
} ) ;
@@ -352,103 +352,103 @@ export class DeprecatedMapMarkerClusterer
352
352
}
353
353
354
354
fitMapToMarkers ( padding : number | google . maps . Padding ) {
355
- this . _assertInitialized ( ) ;
356
- this . markerClusterer . fitMapToMarkers ( padding ) ;
355
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
356
+ this . markerClusterer ! . fitMapToMarkers ( padding ) ;
357
357
}
358
358
359
359
getAverageCenter ( ) : boolean {
360
- this . _assertInitialized ( ) ;
361
- return this . markerClusterer . getAverageCenter ( ) ;
360
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
361
+ return this . markerClusterer ! . getAverageCenter ( ) ;
362
362
}
363
363
364
364
getBatchSizeIE ( ) : number {
365
- this . _assertInitialized ( ) ;
366
- return this . markerClusterer . getBatchSizeIE ( ) ;
365
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
366
+ return this . markerClusterer ! . getBatchSizeIE ( ) ;
367
367
}
368
368
369
369
getCalculator ( ) : Calculator {
370
- this . _assertInitialized ( ) ;
371
- return this . markerClusterer . getCalculator ( ) ;
370
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
371
+ return this . markerClusterer ! . getCalculator ( ) ;
372
372
}
373
373
374
374
getClusterClass ( ) : string {
375
- this . _assertInitialized ( ) ;
376
- return this . markerClusterer . getClusterClass ( ) ;
375
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
376
+ return this . markerClusterer ! . getClusterClass ( ) ;
377
377
}
378
378
379
379
getClusters ( ) : Cluster [ ] {
380
- this . _assertInitialized ( ) ;
381
- return this . markerClusterer . getClusters ( ) ;
380
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
381
+ return this . markerClusterer ! . getClusters ( ) ;
382
382
}
383
383
384
384
getEnableRetinaIcons ( ) : boolean {
385
- this . _assertInitialized ( ) ;
386
- return this . markerClusterer . getEnableRetinaIcons ( ) ;
385
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
386
+ return this . markerClusterer ! . getEnableRetinaIcons ( ) ;
387
387
}
388
388
389
389
getGridSize ( ) : number {
390
- this . _assertInitialized ( ) ;
391
- return this . markerClusterer . getGridSize ( ) ;
390
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
391
+ return this . markerClusterer ! . getGridSize ( ) ;
392
392
}
393
393
394
394
getIgnoreHidden ( ) : boolean {
395
- this . _assertInitialized ( ) ;
396
- return this . markerClusterer . getIgnoreHidden ( ) ;
395
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
396
+ return this . markerClusterer ! . getIgnoreHidden ( ) ;
397
397
}
398
398
399
399
getImageExtension ( ) : string {
400
- this . _assertInitialized ( ) ;
401
- return this . markerClusterer . getImageExtension ( ) ;
400
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
401
+ return this . markerClusterer ! . getImageExtension ( ) ;
402
402
}
403
403
404
404
getImagePath ( ) : string {
405
- this . _assertInitialized ( ) ;
406
- return this . markerClusterer . getImagePath ( ) ;
405
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
406
+ return this . markerClusterer ! . getImagePath ( ) ;
407
407
}
408
408
409
409
getImageSizes ( ) : number [ ] {
410
- this . _assertInitialized ( ) ;
411
- return this . markerClusterer . getImageSizes ( ) ;
410
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
411
+ return this . markerClusterer ! . getImageSizes ( ) ;
412
412
}
413
413
414
414
getMaxZoom ( ) : number {
415
- this . _assertInitialized ( ) ;
416
- return this . markerClusterer . getMaxZoom ( ) ;
415
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
416
+ return this . markerClusterer ! . getMaxZoom ( ) ;
417
417
}
418
418
419
419
getMinimumClusterSize ( ) : number {
420
- this . _assertInitialized ( ) ;
421
- return this . markerClusterer . getMinimumClusterSize ( ) ;
420
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
421
+ return this . markerClusterer ! . getMinimumClusterSize ( ) ;
422
422
}
423
423
424
424
getStyles ( ) : ClusterIconStyle [ ] {
425
- this . _assertInitialized ( ) ;
426
- return this . markerClusterer . getStyles ( ) ;
425
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
426
+ return this . markerClusterer ! . getStyles ( ) ;
427
427
}
428
428
429
429
getTitle ( ) : string {
430
- this . _assertInitialized ( ) ;
431
- return this . markerClusterer . getTitle ( ) ;
430
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
431
+ return this . markerClusterer ! . getTitle ( ) ;
432
432
}
433
433
434
434
getTotalClusters ( ) : number {
435
- this . _assertInitialized ( ) ;
436
- return this . markerClusterer . getTotalClusters ( ) ;
435
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
436
+ return this . markerClusterer ! . getTotalClusters ( ) ;
437
437
}
438
438
439
439
getTotalMarkers ( ) : number {
440
- this . _assertInitialized ( ) ;
441
- return this . markerClusterer . getTotalMarkers ( ) ;
440
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
441
+ return this . markerClusterer ! . getTotalMarkers ( ) ;
442
442
}
443
443
444
444
getZIndex ( ) : number {
445
- this . _assertInitialized ( ) ;
446
- return this . markerClusterer . getZIndex ( ) ;
445
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
446
+ return this . markerClusterer ! . getZIndex ( ) ;
447
447
}
448
448
449
449
getZoomOnClick ( ) : boolean {
450
- this . _assertInitialized ( ) ;
451
- return this . markerClusterer . getZoomOnClick ( ) ;
450
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
451
+ return this . markerClusterer ! . getZoomOnClick ( ) ;
452
452
}
453
453
454
454
private _combineOptions ( ) : MarkerClustererOptions {
@@ -477,7 +477,7 @@ export class DeprecatedMapMarkerClusterer
477
477
}
478
478
479
479
private _watchForMarkerChanges ( ) {
480
- this . _assertInitialized ( ) ;
480
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
481
481
482
482
this . _ngZone . runOutsideAngular ( ( ) => {
483
483
this . _getInternalMarkers ( this . _markers ) . then ( markers => {
@@ -486,14 +486,14 @@ export class DeprecatedMapMarkerClusterer
486
486
this . _currentMarkers . add ( marker ) ;
487
487
initialMarkers . push ( marker ) ;
488
488
}
489
- this . markerClusterer . addMarkers ( initialMarkers ) ;
489
+ this . markerClusterer ! . addMarkers ( initialMarkers ) ;
490
490
} ) ;
491
491
} ) ;
492
492
493
493
this . _markers . changes
494
494
. pipe ( takeUntil ( this . _destroy ) )
495
495
. subscribe ( ( markerComponents : MapMarker [ ] ) => {
496
- this . _assertInitialized ( ) ;
496
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
497
497
this . _ngZone . runOutsideAngular ( ( ) => {
498
498
this . _getInternalMarkers ( markerComponents ) . then ( markers => {
499
499
const newMarkers = new Set ( markers ) ;
@@ -510,9 +510,9 @@ export class DeprecatedMapMarkerClusterer
510
510
markersToRemove . push ( marker ) ;
511
511
}
512
512
}
513
- this . markerClusterer . addMarkers ( markersToAdd , true ) ;
514
- this . markerClusterer . removeMarkers ( markersToRemove , true ) ;
515
- this . markerClusterer . repaint ( ) ;
513
+ this . markerClusterer ! . addMarkers ( markersToAdd , true ) ;
514
+ this . markerClusterer ! . removeMarkers ( markersToRemove , true ) ;
515
+ this . markerClusterer ! . repaint ( ) ;
516
516
for ( const marker of markersToRemove ) {
517
517
this . _currentMarkers . delete ( marker ) ;
518
518
}
@@ -526,15 +526,13 @@ export class DeprecatedMapMarkerClusterer
526
526
) : Promise < google . maps . Marker [ ] > {
527
527
return Promise . all ( markers . map ( markerComponent => markerComponent . _resolveMarker ( ) ) ) ;
528
528
}
529
+ }
529
530
530
- private _assertInitialized ( ) : asserts this is { markerClusterer : MarkerClustererInstance } {
531
- if ( typeof ngDevMode === 'undefined' || ngDevMode ) {
532
- if ( ! this . markerClusterer ) {
533
- throw Error (
534
- 'Cannot interact with a MarkerClusterer before it has been initialized. ' +
535
- 'Please wait for the MarkerClusterer to load before trying to interact with it.' ,
536
- ) ;
537
- }
538
- }
531
+ function assertInitialized ( ctx : DeprecatedMapMarkerClusterer ) {
532
+ if ( ! ctx . markerClusterer ) {
533
+ throw Error (
534
+ 'Cannot interact with a MarkerClusterer before it has been initialized. ' +
535
+ 'Please wait for the MarkerClusterer to load before trying to interact with it.' ,
536
+ ) ;
539
537
}
540
538
}
0 commit comments