forked from cerc-io/cosmos-explorer
feat: The timer is cleared uniformly
This commit is contained in:
parent
b1f5684638
commit
5e03afec0a
@ -20,7 +20,7 @@ let rate = ref('');
|
|||||||
let height = ref('');
|
let height = ref('');
|
||||||
let round = ref('');
|
let round = ref('');
|
||||||
let step = ref('');
|
let step = ref('');
|
||||||
let timer = null;
|
let timer = null as any;
|
||||||
let updatetime = ref(new Date());
|
let updatetime = ref(new Date());
|
||||||
let positions = ref([]);
|
let positions = ref([]);
|
||||||
let validatorsData = ref([] as any);
|
let validatorsData = ref([] as any);
|
||||||
@ -30,14 +30,19 @@ onMounted(async () => {
|
|||||||
rpc.value = rpcList.value[0].address + '/consensus_state';
|
rpc.value = rpcList.value[0].address + '/consensus_state';
|
||||||
fetchPosition();
|
fetchPosition();
|
||||||
update();
|
update();
|
||||||
|
clearTime()
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
update();
|
update();
|
||||||
}, 6000);
|
}, 6000);
|
||||||
});
|
});
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
timer = null;
|
clearTime();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function clearTime() {
|
||||||
|
clearInterval(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
const newTime = computed(() => {
|
const newTime = computed(() => {
|
||||||
return format.toDay(updatetime.value, 'time');
|
return format.toDay(updatetime.value, 'time');
|
||||||
});
|
});
|
||||||
@ -79,7 +84,7 @@ function onChange() {
|
|||||||
httpstatus.value = 200;
|
httpstatus.value = 200;
|
||||||
httpStatusText.value = '';
|
httpStatusText.value = '';
|
||||||
roundState.value = {};
|
roundState.value = {};
|
||||||
timer = null;
|
clearTime();
|
||||||
fetchPosition();
|
fetchPosition();
|
||||||
update();
|
update();
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user