Defining Javascript classes programmatically in Jint 3 #1411
Unanswered
hcaandersen
asked this question in
Q&A
Replies: 3 comments 9 replies
-
Did you check the examples in readme? |
Beta Was this translation helpful? Give feedback.
6 replies
-
@lahma will never get enough gifts https://github.com/sponsors/lahma |
Beta Was this translation helpful? Give feedback.
1 reply
-
I started the project but getting busy with other projects and work so for some time now @lahma is the boss and deserves all the credits for the recent improvements like ES6 features and performance work. Also why I sponsor him myself ;) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Jint 3, how do I either (a) define Javascript classes programmatically or (b) allow scripts to have the keyword,
new
, before function calls?Scripts like
var c = new MyClass()
worked with the (very) old version that I was using, but fail in Jint 3 with the exception "MyClass is not a constructor".Note that
MyClass
is currently defined programmatically (in C#) as a function. I've tried to work out how to define classes programmatically, but haven't yet succeeded. I'd prefer not to do so, as my code, which defines them as functions, work fine as long as I don't use thenew
keyword.Beta Was this translation helpful? Give feedback.
All reactions