BigW Consortium Gitlab

Commit 05c409d2 by Regis

use nextTick and cache timeAgoEl

parent 7a37ada1
<script> <script>
import Vue from 'vue';
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import Poll from './../lib/utils/poll'; import Poll from './../lib/utils/poll';
import Service from './services/index'; import Service from './services/index';
...@@ -37,13 +38,13 @@ export default { ...@@ -37,13 +38,13 @@ export default {
return { return {
poll, poll,
apiData: {}, apiData: {},
timeoutId: null,
title: null, title: null,
titleText: '', titleText: '',
tasks: '0 of 0',
description: null, description: null,
descriptionText: '', descriptionText: '',
descriptionChange: false, descriptionChange: false,
tasks: '0 of 0', timeAgoEl: $('.issue_edited_ago'),
titleEl: document.querySelector('title'), titleEl: document.querySelector('title'),
}; };
}, },
...@@ -86,18 +87,18 @@ export default { ...@@ -86,18 +87,18 @@ export default {
this.titleEl.innerText = currentTabTitleScope.join('·'); this.titleEl.innerText = currentTabTitleScope.join('·');
}, },
animate(title, description, elementsToVisualize) { animate(title, description, elementsToVisualize) {
this.timeoutId = setTimeout(() => { this.title = title;
this.title = title; this.description = description;
this.description = description; this.setTabTitle();
this.setTabTitle();
Vue.nextTick(() => {
elementsToVisualize.forEach((element) => { elementsToVisualize.forEach((element) => {
if (element) { if (element) {
element.classList.remove('issue-realtime-pre-pulse'); element.classList.remove('issue-realtime-pre-pulse');
element.classList.add('issue-realtime-trigger-pulse'); element.classList.add('issue-realtime-trigger-pulse');
} }
}); });
}, 0); });
}, },
triggerAnimation() { triggerAnimation() {
// always reset to false before checking the change // always reset to false before checking the change
...@@ -124,10 +125,9 @@ export default { ...@@ -124,10 +125,9 @@ export default {
}, },
updateEditedTimeAgo() { updateEditedTimeAgo() {
const toolTipTime = gl.utils.formatDate(this.apiData.updated_at); const toolTipTime = gl.utils.formatDate(this.apiData.updated_at);
const $timeAgoNode = $('.issue_edited_ago');
$timeAgoNode.attr('datetime', this.apiData.updated_at); this.timeAgoEl.attr('datetime', this.apiData.updated_at);
$timeAgoNode.attr('data-original-title', toolTipTime); this.timeAgoEl.attr('data-original-title', toolTipTime);
}, },
}, },
computed: { computed: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment