currently i am having a conceptional issue in my application.
A user should be able to create a Javascript class inside my react/redux application and my application should be able to execute the written javascript code.
Example, User A writes:
class PredefinedClassName {
constructor(a) {
this.a = a;
}
getSomething(parameterFromOutside) {
return this.a * parameterFromOutside;
}
}
This class is then saved as a string(important) in some database.
Next i want to load this class(as a string again) and do the following:
- Create instance of this class which is contained in the string... (How?)
- Call "getSomething" method on the instance and pass my own parameter to the method(How?)
As this is a quite rare use case, there is only very few literature about and almost no library.
Site note: On top of it, i should also check for syntax and runtime errors, but i consider this as the next step so first i would like to solve the elementary part.
Do you have any ideas about how solve this conceptional issue?
Thanks and Greetings!