From 4e1b7dfdd9a5daebd38467df8c5fa06869e5b4b2 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Wed, 7 Jun 2023 17:05:49 +0200 Subject: [PATCH] manual rerun on graph --- index.html | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) 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', { - +