@@ -58,7 +58,7 @@ export default class DecorationManagement {
5858 * @type {Object }
5959 * @access private
6060 */
61- this . decorationUpdatedSubscriptions = { }
61+ this . decorationUpdatedSubscriptions = new Map ( )
6262 /**
6363 * The subscriptions to the decorations `did-destroy` event indexed using
6464 * the decoration id.
@@ -402,11 +402,11 @@ export default class DecorationManagement {
402402 this . decorationsByMarkerId . get ( id ) . push ( decoration )
403403 this . decorationsById . set ( decoration . id , decoration )
404404
405- if ( this . decorationUpdatedSubscriptions [ decoration . id ] == null ) {
406- this . decorationUpdatedSubscriptions [ decoration . id ] =
405+ if ( ! this . decorationUpdatedSubscriptions . has ( decoration . id ) ) {
406+ this . decorationUpdatedSubscriptions . set ( decoration . id ,
407407 decoration . onDidChangeProperties ( ( event ) => {
408408 this . emitDecorationChanges ( type , decoration )
409- } )
409+ } ) )
410410 }
411411
412412 this . decorationDestroyedSubscriptions [ decoration . id ] =
@@ -526,13 +526,13 @@ export default class DecorationManagement {
526526
527527 this . decorationsById . delete ( decoration . id )
528528
529- subscription = this . decorationUpdatedSubscriptions [ decoration . id ]
529+ subscription = this . decorationUpdatedSubscriptions . get ( decoration . id )
530530 if ( subscription != null ) { subscription . dispose ( ) }
531531
532532 subscription = this . decorationDestroyedSubscriptions [ decoration . id ]
533533 if ( subscription != null ) { subscription . dispose ( ) }
534534
535- delete this . decorationUpdatedSubscriptions [ decoration . id ]
535+ this . decorationUpdatedSubscriptions . delete ( decoration . id )
536536 delete this . decorationDestroyedSubscriptions [ decoration . id ]
537537
538538 const decorations = this . decorationsByMarkerId . get ( marker . id )
@@ -614,8 +614,9 @@ export default class DecorationManagement {
614614 decoration . dispose ( )
615615 }
616616
617- for ( const id in this . decorationUpdatedSubscriptions ) {
618- this . decorationUpdatedSubscriptions [ id ] . dispose ( )
617+ const decorationUpdatedSubscriptionsValues = this . decorationUpdatedSubscriptions . values ( )
618+ for ( const decoration of decorationUpdatedSubscriptionsValues ) {
619+ decoration . dispose ( )
619620 }
620621
621622 for ( const id in this . decorationDestroyedSubscriptions ) {
@@ -631,7 +632,7 @@ export default class DecorationManagement {
631632 this . decorationsByMarkerId . clear ( )
632633 this . decorationMarkerChangedSubscriptions . clear ( )
633634 this . decorationMarkerDestroyedSubscriptions . clear ( )
634- this . decorationUpdatedSubscriptions = { }
635+ this . decorationUpdatedSubscriptions . clear ( )
635636 this . decorationDestroyedSubscriptions = { }
636637 }
637638}
0 commit comments