Skip to content

Commit

Permalink
Merge pull request #113 from rhagigi/unsubscribeStore
Browse files Browse the repository at this point in the history
Unsubscribe from store on remove
  • Loading branch information
tmcw authored Jan 23, 2017
2 parents 36628aa + efdfdc2 commit 2240b1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/directions.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export default class MapboxDirections {
map.off('touchstart', this.onDragDown);
map.off('touchstart', this.move);
map.off('click', this.onClick);
if (this.storeUnsubscribe) {
this.storeUnsubscribe();
delete this.storeUnsubscribe;
}
this._map = null;
return this;
}
Expand Down Expand Up @@ -137,7 +141,7 @@ export default class MapboxDirections {
}

subscribedActions() {
store.subscribe(() => {
this.storeUnsubscribe = store.subscribe(() => {
const {
origin,
destination,
Expand Down

0 comments on commit 2240b1e

Please sign in to comment.