Skip to content

Commit 25ce0f6

Browse files
author
Lionel Laské
committed
Merge branch 'pr/1906' into dev
2 parents 9be7b0b + e1d7aa6 commit 25ce0f6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

js/screens/listview.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ const ListView = {
103103
this.getUser();
104104
},
105105

106+
beforeUnmount() {
107+
if (this.timer) {
108+
window.clearTimeout(this.timer);
109+
}
110+
},
111+
106112
computed: {
107113
sortedActivities() {
108114
return this.sortByName(this.activities);
@@ -144,7 +150,7 @@ const ListView = {
144150
}
145151

146152
this.$refs.popup.hide();
147-
sugarizer.modules.user.update({"favorites": this.favactivities }).then((user) => {
153+
sugarizer.modules.user.update({ "favorites": this.favactivities }).then((user) => {
148154
const iconRef = this.$refs["star" + activity.id][0];
149155
if (iconRef.colorData == this.buddycolor) {
150156
iconRef.colorData = 256;
@@ -206,9 +212,9 @@ const ListView = {
206212

207213
async showPopupTimer(e) {
208214
if (this.timer != null) {
209-
window.clearInterval(this.timer);
215+
window.clearTimeout(this.timer);
210216
}
211-
this.timer = window.setInterval(this.showPopup.bind(this), this.constant.timerPopupDuration, e);
217+
this.timer = window.setTimeout(this.showPopup.bind(this), this.constant.timerPopupDuration, e);
212218
},
213219

214220
async showPopup(e) {
@@ -217,7 +223,7 @@ const ListView = {
217223
this.removeCurrentPopup();
218224
}
219225
this.popupShown = true;
220-
window.clearInterval(this.timer);
226+
window.clearTimeout(this.timer);
221227
this.timer = null;
222228
await this.computePopup();
223229
if (e.target.tagName == 'svg') {
@@ -242,9 +248,9 @@ const ListView = {
242248

243249
async removePopupTimer(e) {
244250
if (this.timer != null) {
245-
window.clearInterval(this.timer);
251+
window.clearTimeout(this.timer);
246252
}
247-
this.timer = window.setInterval(this.removePopup.bind(this), this.constant.timerPopupDuration, e);
253+
this.timer = window.setTimeout(this.removePopup.bind(this), this.constant.timerPopupDuration, e);
248254
},
249255

250256
async removePopup(e) {
@@ -256,7 +262,7 @@ const ListView = {
256262
removeCurrentPopup() {
257263
this.$refs.popup.hide();
258264
this.popupShown = false;
259-
window.clearInterval(this.timer);
265+
window.clearTimeout(this.timer);
260266
this.timer = null;
261267
},
262268

@@ -269,7 +275,7 @@ const ListView = {
269275
}
270276
},
271277
clearSearchField() {
272-
this.$emit('clear-searchfield');
278+
this.$emit('clear-searchfield');
273279
},
274280
startActivitiesTutorial(startFromIndex) {
275281
sugarizer.modules.tutorial.startTutorial(sugarizer.constant.activities, {

0 commit comments

Comments
 (0)