setInterval() to tick method

warmup
Fabien Benetou 2 years ago
parent 5d17a90bd6
commit 4ef9c21df2
  1. 11
      index.html

@ -1278,18 +1278,19 @@ AFRAME.registerComponent('glossary', {
AFRAME.registerComponent('fot', { AFRAME.registerComponent('fot', {
init:function(){ init:function(){
},
tick: function(){
let generatorName = this.attrName let generatorName = this.attrName
setInterval( _ => fetch("https://fabien.benetou.fr/PIMVRdata/FoT?action=source#" + Date.now()).then(res => res.text() ).then(res => { fetch("https://fabien.benetou.fr/PIMVRdata/FoT?action=source#" + Date.now()).then(res => res.text() ).then(res => {
// consider tick() instead
res.split("\n").slice(0,maxItemsFromSources).map( (n,i) => { res.split("\n").slice(0,maxItemsFromSources).map( (n,i) => {
found = added.find((str) => str === n) found = added.find((str) => str === n)
if (typeof found === 'undefined'){ if (typeof found === 'undefined'){
added.push(n) added.push(n)
addNewNote( n, "-1 "+(1+i/10)+" -2.5", ".1 .1 .1", null, generatorName ) addNewNote( n, "-1 "+(1+i/10)+" -2.5", ".1 .1 .1", null, generatorName )
} }
}) })
}), 100 ) })
}, }
}); });
AFRAME.registerComponent('issues', { AFRAME.registerComponent('issues', {

Loading…
Cancel
Save