Skip to content

Commit 86804cc

Browse files
committed
Remove listener
1 parent d298d94 commit 86804cc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/internal.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ export class Internal {
5959
* @type {Function}
6060
*/
6161
this.eventHandler = this.handleEvent.bind(this);
62+
/**
63+
* @type {Function}
64+
*/
65+
this.eventMapMoveHandler = this.handleMapMoveEvent.bind(this);
6266
return this;
6367
}
6468

@@ -175,9 +179,7 @@ export class Internal {
175179
false
176180
);
177181

178-
this.map.on('movestart', (event) => {
179-
this.closeMenu();
180-
});
182+
this.map.on('movestart', this.eventMapMoveHandler);
181183
}
182184

183185
removeListeners() {
@@ -186,6 +188,8 @@ export class Internal {
186188
this.eventHandler,
187189
false
188190
);
191+
192+
this.map.un('movestart', this.eventMapMoveHandler);
189193
}
190194

191195
handleEvent(evt) {
@@ -226,6 +230,10 @@ export class Internal {
226230
);
227231
}
228232

233+
handleMapMoveEvent(evt) {
234+
this.closeMenu();
235+
}
236+
229237
setItemListener(li, index) {
230238
const this_ = this;
231239
if (li && typeof this.items[index].callback === 'function') {

0 commit comments

Comments
 (0)