From b7f07ccbe0bb139d02b490b9dc7440982224ca1c Mon Sep 17 00:00:00 2001 From: Oliver Gerlich Date: Sun, 15 Jul 2018 22:46:37 +0200 Subject: [PATCH] node page: fix bug if navigator.geolocation.watchPosition() returns 0 as id --- webroot/js/view/node.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webroot/js/view/node.js b/webroot/js/view/node.js index cc39624..b3c6181 100644 --- a/webroot/js/view/node.js +++ b/webroot/js/view/node.js @@ -94,13 +94,13 @@ export class NodeView extends View { this.btnGPS.classList.add('btn'); this.btnGPS.innerHTML = 'Start follow position'; this.btnGPS.addEventListener('click', () => { - if (this.editLocationGPS) { + if (this.editLocationGPS != null) { if (this.btnGPS.innerHTML === 'Stop following') { updatePosition(); } this.btnGPS.innerHTML = 'Start follow position'; navigator.geolocation.clearWatch(this.editLocationGPS); - this.editLocationGPS = false; + this.editLocationGPS = null; return; } @@ -177,7 +177,7 @@ export class NodeView extends View { this.hostnameInput.value = node.hostname; this.ownerInput.value = node.owner; - if (!this.editLocationGPS && node.location && node.location.latitude && node.location.longitude) { + if (this.editLocationGPS == null && node.location && node.location.latitude && node.location.longitude) { // eslint-disable-next-line one-var const latlng = [node.location.latitude, node.location.longitude];