Currently, I am immersed in a project that involves a significant amount of user-generated code (influenced by this video ). My objective is to evaluate a portion of user-input code using eval(), and trigger a function every time a variable is defined, two variables are multiplied, or any other specific action takes place.
Is it feasible to accomplish this task using JavaScript?
One potential approach could involve scanning the input for instances of "var ...", analyzing what follows, and then performing the necessary actions. However, for various reasons, I would prefer to handle this process more legitimately by directly responding to code execution events.