From 4ef9c21df21d6fc92b3812416c4a1d52ebf6dfbb Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Sat, 1 Oct 2022 22:12:18 +0200 Subject: [PATCH] setInterval() to tick method --- index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 8332c7f..6e14efe 100644 --- a/index.html +++ b/index.html @@ -1278,18 +1278,19 @@ AFRAME.registerComponent('glossary', { AFRAME.registerComponent('fot', { init:function(){ + }, + tick: function(){ let generatorName = this.attrName - setInterval( _ => fetch("https://fabien.benetou.fr/PIMVRdata/FoT?action=source#" + Date.now()).then(res => res.text() ).then(res => { - // consider tick() instead + fetch("https://fabien.benetou.fr/PIMVRdata/FoT?action=source#" + Date.now()).then(res => res.text() ).then(res => { res.split("\n").slice(0,maxItemsFromSources).map( (n,i) => { found = added.find((str) => str === n) if (typeof found === 'undefined'){ added.push(n) addNewNote( n, "-1 "+(1+i/10)+" -2.5", ".1 .1 .1", null, generatorName ) -} + } }) - }), 100 ) - }, + }) + } }); AFRAME.registerComponent('issues', {