Skip to content

Commit d030434

Browse files
committed
fix: use normal loop and object keys to loop in clear
1 parent dc5cefb commit d030434

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/minimap-find-and-replace-binding.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,17 @@ class MinimapFindAndReplaceBinding {
4949
}
5050

5151
clear () {
52-
let id
53-
for (id in this.subscriptionsByMarkerId) {
54-
const sub = this.subscriptionsByMarkerId[id]
55-
sub.dispose()
52+
const subscriptionsByMarkerIdKeys = Object.keys(this.subscriptionsByMarkerId)
53+
for (let i = 0, len = subscriptionsByMarkerIdKeys.length; i < len; i++) {
54+
const id = subscriptionsByMarkerIdKeys[i]
55+
this.subscriptionsByMarkerId[id].dispose()
5656
delete this.subscriptionsByMarkerId[id]
5757
}
5858

59-
for (id in this.decorationsByMarkerId) {
60-
const decoration = this.decorationsByMarkerId[id]
61-
decoration.destroy()
59+
const decorationsByMarkerIdKeys = Object.keys(this.decorationsByMarkerId)
60+
for (let i = 0, len = decorationsByMarkerIdKeys.length; i < len; i++) {
61+
const id = decorationsByMarkerIdKeys[i]
62+
this.decorationsByMarkerId[id].destroy()
6263
delete this.decorationsByMarkerId[id]
6364
}
6465
}

0 commit comments

Comments
 (0)