@@ -44,7 +44,7 @@ export default class DecorationManagement {
4444 * @type {Object }
4545 * @access private
4646 */
47- this . decorationMarkerChangedSubscriptions = { }
47+ this . decorationMarkerChangedSubscriptions = new Map ( )
4848 /**
4949 * The subscriptions to the markers `did-destroy` event indexed using the
5050 * marker id.
@@ -345,8 +345,8 @@ export default class DecorationManagement {
345345 } )
346346 }
347347
348- if ( this . decorationMarkerChangedSubscriptions [ id ] == null ) {
349- this . decorationMarkerChangedSubscriptions [ id ] =
348+ if ( ! this . decorationMarkerChangedSubscriptions . has ( id ) ) {
349+ this . decorationMarkerChangedSubscriptions . set ( id ,
350350 marker . onDidChange ( ( event ) => {
351351 const decorations = this . decorationsByMarkerId . get ( id )
352352 const screenRange = marker . getScreenRange ( )
@@ -390,7 +390,7 @@ export default class DecorationManagement {
390390 end : end
391391 } , 0 )
392392 }
393- } )
393+ } ) )
394394 }
395395
396396 const decoration = new Decoration ( marker , this , decorationParams )
@@ -592,20 +592,21 @@ export default class DecorationManagement {
592592 removedAllMarkerDecorations ( marker ) {
593593 if ( marker == null ) { return }
594594
595- this . decorationMarkerChangedSubscriptions [ marker . id ] . dispose ( )
595+ this . decorationMarkerChangedSubscriptions . get ( marker . id ) . dispose ( )
596596 this . decorationMarkerDestroyedSubscriptions [ marker . id ] . dispose ( )
597597
598598 this . decorationsByMarkerId . delete ( marker . id )
599- delete this . decorationMarkerChangedSubscriptions [ marker . id ]
599+ this . decorationMarkerChangedSubscriptions . delete ( marker . id )
600600 delete this . decorationMarkerDestroyedSubscriptions [ marker . id ]
601601 }
602602
603603 /**
604604 * Removes all the decorations that was created in the current `Minimap`.
605605 */
606606 removeAllDecorations ( ) {
607- for ( const id in this . decorationMarkerChangedSubscriptions ) {
608- this . decorationMarkerChangedSubscriptions [ id ] . dispose ( )
607+ const decorationMarkerChangedSubscriptionsValues = this . decorationMarkerChangedSubscriptions . values ( )
608+ for ( const decoration of decorationMarkerChangedSubscriptionsValues ) {
609+ decoration . dispose ( )
609610 }
610611
611612 for ( const id in this . decorationMarkerDestroyedSubscriptions ) {
@@ -627,7 +628,7 @@ export default class DecorationManagement {
627628
628629 this . decorationsById . clear ( )
629630 this . decorationsByMarkerId . clear ( )
630- this . decorationMarkerChangedSubscriptions = { }
631+ this . decorationMarkerChangedSubscriptions . clear ( )
631632 this . decorationMarkerDestroyedSubscriptions = { }
632633 this . decorationUpdatedSubscriptions = { }
633634 this . decorationDestroyedSubscriptions = { }
0 commit comments