@@ -244,7 +244,7 @@ export class DeprecatedMapMarkerClusterer
244244 return new MarkerClusterer ( map , [ ] , this . _combineOptions ( ) ) ;
245245 } ) ;
246246
247- this . _assertInitialized ( ) ;
247+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
248248 this . _eventManager . setTarget ( this . markerClusterer ) ;
249249 this . markerClustererInitialized . emit ( this . markerClusterer ) ;
250250 } ) ;
@@ -352,103 +352,103 @@ export class DeprecatedMapMarkerClusterer
352352 }
353353
354354 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 ) ;
357357 }
358358
359359 getAverageCenter ( ) : boolean {
360- this . _assertInitialized ( ) ;
361- return this . markerClusterer . getAverageCenter ( ) ;
360+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
361+ return this . markerClusterer ! . getAverageCenter ( ) ;
362362 }
363363
364364 getBatchSizeIE ( ) : number {
365- this . _assertInitialized ( ) ;
366- return this . markerClusterer . getBatchSizeIE ( ) ;
365+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
366+ return this . markerClusterer ! . getBatchSizeIE ( ) ;
367367 }
368368
369369 getCalculator ( ) : Calculator {
370- this . _assertInitialized ( ) ;
371- return this . markerClusterer . getCalculator ( ) ;
370+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
371+ return this . markerClusterer ! . getCalculator ( ) ;
372372 }
373373
374374 getClusterClass ( ) : string {
375- this . _assertInitialized ( ) ;
376- return this . markerClusterer . getClusterClass ( ) ;
375+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
376+ return this . markerClusterer ! . getClusterClass ( ) ;
377377 }
378378
379379 getClusters ( ) : Cluster [ ] {
380- this . _assertInitialized ( ) ;
381- return this . markerClusterer . getClusters ( ) ;
380+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
381+ return this . markerClusterer ! . getClusters ( ) ;
382382 }
383383
384384 getEnableRetinaIcons ( ) : boolean {
385- this . _assertInitialized ( ) ;
386- return this . markerClusterer . getEnableRetinaIcons ( ) ;
385+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
386+ return this . markerClusterer ! . getEnableRetinaIcons ( ) ;
387387 }
388388
389389 getGridSize ( ) : number {
390- this . _assertInitialized ( ) ;
391- return this . markerClusterer . getGridSize ( ) ;
390+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
391+ return this . markerClusterer ! . getGridSize ( ) ;
392392 }
393393
394394 getIgnoreHidden ( ) : boolean {
395- this . _assertInitialized ( ) ;
396- return this . markerClusterer . getIgnoreHidden ( ) ;
395+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
396+ return this . markerClusterer ! . getIgnoreHidden ( ) ;
397397 }
398398
399399 getImageExtension ( ) : string {
400- this . _assertInitialized ( ) ;
401- return this . markerClusterer . getImageExtension ( ) ;
400+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
401+ return this . markerClusterer ! . getImageExtension ( ) ;
402402 }
403403
404404 getImagePath ( ) : string {
405- this . _assertInitialized ( ) ;
406- return this . markerClusterer . getImagePath ( ) ;
405+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
406+ return this . markerClusterer ! . getImagePath ( ) ;
407407 }
408408
409409 getImageSizes ( ) : number [ ] {
410- this . _assertInitialized ( ) ;
411- return this . markerClusterer . getImageSizes ( ) ;
410+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
411+ return this . markerClusterer ! . getImageSizes ( ) ;
412412 }
413413
414414 getMaxZoom ( ) : number {
415- this . _assertInitialized ( ) ;
416- return this . markerClusterer . getMaxZoom ( ) ;
415+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
416+ return this . markerClusterer ! . getMaxZoom ( ) ;
417417 }
418418
419419 getMinimumClusterSize ( ) : number {
420- this . _assertInitialized ( ) ;
421- return this . markerClusterer . getMinimumClusterSize ( ) ;
420+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
421+ return this . markerClusterer ! . getMinimumClusterSize ( ) ;
422422 }
423423
424424 getStyles ( ) : ClusterIconStyle [ ] {
425- this . _assertInitialized ( ) ;
426- return this . markerClusterer . getStyles ( ) ;
425+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
426+ return this . markerClusterer ! . getStyles ( ) ;
427427 }
428428
429429 getTitle ( ) : string {
430- this . _assertInitialized ( ) ;
431- return this . markerClusterer . getTitle ( ) ;
430+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
431+ return this . markerClusterer ! . getTitle ( ) ;
432432 }
433433
434434 getTotalClusters ( ) : number {
435- this . _assertInitialized ( ) ;
436- return this . markerClusterer . getTotalClusters ( ) ;
435+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
436+ return this . markerClusterer ! . getTotalClusters ( ) ;
437437 }
438438
439439 getTotalMarkers ( ) : number {
440- this . _assertInitialized ( ) ;
441- return this . markerClusterer . getTotalMarkers ( ) ;
440+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
441+ return this . markerClusterer ! . getTotalMarkers ( ) ;
442442 }
443443
444444 getZIndex ( ) : number {
445- this . _assertInitialized ( ) ;
446- return this . markerClusterer . getZIndex ( ) ;
445+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
446+ return this . markerClusterer ! . getZIndex ( ) ;
447447 }
448448
449449 getZoomOnClick ( ) : boolean {
450- this . _assertInitialized ( ) ;
451- return this . markerClusterer . getZoomOnClick ( ) ;
450+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
451+ return this . markerClusterer ! . getZoomOnClick ( ) ;
452452 }
453453
454454 private _combineOptions ( ) : MarkerClustererOptions {
@@ -477,7 +477,7 @@ export class DeprecatedMapMarkerClusterer
477477 }
478478
479479 private _watchForMarkerChanges ( ) {
480- this . _assertInitialized ( ) ;
480+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
481481
482482 this . _ngZone . runOutsideAngular ( ( ) => {
483483 this . _getInternalMarkers ( this . _markers ) . then ( markers => {
@@ -486,14 +486,14 @@ export class DeprecatedMapMarkerClusterer
486486 this . _currentMarkers . add ( marker ) ;
487487 initialMarkers . push ( marker ) ;
488488 }
489- this . markerClusterer . addMarkers ( initialMarkers ) ;
489+ this . markerClusterer ! . addMarkers ( initialMarkers ) ;
490490 } ) ;
491491 } ) ;
492492
493493 this . _markers . changes
494494 . pipe ( takeUntil ( this . _destroy ) )
495495 . subscribe ( ( markerComponents : MapMarker [ ] ) => {
496- this . _assertInitialized ( ) ;
496+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && assertInitialized ( this ) ;
497497 this . _ngZone . runOutsideAngular ( ( ) => {
498498 this . _getInternalMarkers ( markerComponents ) . then ( markers => {
499499 const newMarkers = new Set ( markers ) ;
@@ -510,9 +510,9 @@ export class DeprecatedMapMarkerClusterer
510510 markersToRemove . push ( marker ) ;
511511 }
512512 }
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 ( ) ;
516516 for ( const marker of markersToRemove ) {
517517 this . _currentMarkers . delete ( marker ) ;
518518 }
@@ -526,15 +526,13 @@ export class DeprecatedMapMarkerClusterer
526526 ) : Promise < google . maps . Marker [ ] > {
527527 return Promise . all ( markers . map ( markerComponent => markerComponent . _resolveMarker ( ) ) ) ;
528528 }
529+ }
529530
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+ ) ;
539537 }
540538}
0 commit comments