diff --git a/index.html b/index.html index 35ad92a..27934b9 100644 --- a/index.html +++ b/index.html @@ -3251,6 +3251,17 @@ function traverseFunctionGraph( g ){ return callStack } +function generateGraphThenRun(){ + let g = generateGraphFromEditors(editors) + traverseFunctionGraph( g ).map( e => { + try { + nodalValue = eval?.( e.editor.page ) + } catch (error) { + console.error(`Evaluation failed with ${error}`); + } + } ) +} + // used for testing AFRAME.registerComponent('startfunctions', { init: function () { @@ -3264,15 +3275,8 @@ AFRAME.registerComponent('startfunctions', { setTimeout( _ => { console.clear() //console.log( connectionsBetweenEditors( editors[0], editors[2] ) ) - let g = generateGraphFromEditors(editors) //console.log( numberOfPredecessors( g ), numberOfSuccessors( g ) ) - traverseFunctionGraph( g ).map( e => { - try { - nodalValue = eval?.( e.editor.page ) - } catch (error) { - console.error(`Evaluation failed with ${error}`); - } - } ) + generateGraphThenRun() } , 1000 ) // should be done after each codeEditors gets connectors added then on editor moves }, false); @@ -3331,7 +3335,7 @@ AFRAME.registerComponent('startfunctions', { - +