JS-Interpreter icon indicating copy to clipboard operation
JS-Interpreter copied to clipboard

How to get the function in the return value

Open 805808786 opened this issue 2 years ago • 0 comments

I am using JS-Interpreter to parse the code blocks entered by the user in the editor. I hope to get the functions entered by the user in some cases, so that these code blocks can participate in some business logic, but in fact I can't get these data. const initChart = (editorContent) => { const option = JSSandbox(editorContent, { echarts }); // option.series[0].textStyle.normal.color is {} // But I hope it is a function console.log(option); if (Object.prototype.toString.call(option) === '[object Object]') { const chart = echarts.init(ref.current); chart.clear(); chart.setOption(option); } };

my case

805808786 avatar Mar 14 '23 10:03 805808786