From 1f8109e8b8eec735a1ce1bf4be99ff60a618af06 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Fri, 19 Jul 2019 19:52:19 +0200 Subject: [PATCH] preserve scope --- static/js/overlays/TrainOverlay.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/overlays/TrainOverlay.js b/static/js/overlays/TrainOverlay.js index e314170..4bd19ab 100644 --- a/static/js/overlays/TrainOverlay.js +++ b/static/js/overlays/TrainOverlay.js @@ -180,14 +180,14 @@ export default L.LayerGroup.extend({ }, onAdd: function(/*map*/) { - this.layerMgr.addListener(this.reDraw); - this.wsChannel.addListener("minetest-info", this.onMinetestUpdate); + this.layerMgr.addListener(() => this.reDraw()); + this.wsChannel.addListener("minetest-info", () => this.onMinetestUpdate()); this.reDraw(); }, onRemove: function(/*map*/) { this.clearLayers(); - this.layerMgr.removeListener(this.reDraw); - this.wsChannel.removeListener("minetest-info", this.onMinetestUpdate); + this.layerMgr.removeListener(() => this.reDraw()); + this.wsChannel.removeListener("minetest-info", () => this.onMinetestUpdate()); } });