JS-Interpreter
JS-Interpreter copied to clipboard
How to get the function in the return value
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); } };