@@ -8,8 +8,8 @@ class MinimapBookmarksBinding {
88
99 this . subscriptions = new CompositeDisposable ( )
1010 this . editor = this . minimap . getTextEditor ( )
11- this . decorationsByMarkerId = { }
12- this . decorationSubscriptionsByMarkerId = { }
11+ this . decorationsByMarkerId = new Map ( )
12+ this . decorationSubscriptionsByMarkerId = new Map ( )
1313
1414 // We need to wait until the bookmarks package had created its marker
1515 // layer before retrieving its id from the state.
@@ -39,23 +39,26 @@ class MinimapBookmarksBinding {
3939 handleMarker ( marker ) {
4040 const { id } = marker
4141 const decoration = this . minimap . decorateMarker ( marker , { type : 'line' , class : 'bookmark' , plugin : 'bookmarks' } )
42- this . decorationsByMarkerId [ id ] = decoration
43- this . decorationSubscriptionsByMarkerId [ id ] = decoration . onDidDestroy ( ( ) => {
44- this . decorationSubscriptionsByMarkerId [ id ] . dispose ( )
42+ this . decorationsByMarkerId . set ( id , decoration )
43+ this . decorationSubscriptionsByMarkerId . set ( id ,
44+ decoration . onDidDestroy ( ( ) => {
45+ this . decorationSubscriptionsByMarkerId . get ( id ) . dispose ( )
4546
46- delete this . decorationsByMarkerId [ id ]
47- delete this . decorationSubscriptionsByMarkerId [ id ]
48- } )
47+ this . decorationsByMarkerId . delete ( id )
48+ this . decorationSubscriptionsByMarkerId . delete ( id )
49+ } ) ,
50+ )
4951 }
5052
5153 destroy ( ) {
52- for ( const id in this . decorationsByMarkerId ) {
53- const decoration = this . decorationsByMarkerId [ id ]
54- this . decorationSubscriptionsByMarkerId [ id ] . dispose ( )
54+ const ids = this . decorationsByMarkerId . keys ( )
55+ for ( const id of ids ) {
56+ const decoration = this . decorationsByMarkerId . get ( id )
57+ this . decorationSubscriptionsByMarkerId . get ( id ) . dispose ( )
5558 decoration . destroy ( )
5659
57- delete this . decorationsByMarkerId [ id ]
58- delete this . decorationSubscriptionsByMarkerId [ id ]
60+ this . decorationsByMarkerId . delete ( id )
61+ this . decorationSubscriptionsByMarkerId . delete ( id )
5962 }
6063
6164 this . subscriptions . dispose ( )
0 commit comments