Closed azam closed 1 year ago
If you want a function to be a constructor you should first turn it into a javascript function and then set it as a constructor using Function::set_constructor
.
The bind macro does this for you by creating a constructor for class with Class::constructor
@DelSkayn Thanks! I forgot I asked this. I eventually got to the Function::set_constructor.
Hi!
I want to be able to define an
Object.prototype.constructor
for my custom object. I am trying to add a subset of ECMA402 to my project, which are not implemented as classes.Is it possible to do it without classes? If yes, how would I change my minimal reproduction code below?
FYI replacing
Name('John','Doe')
withnew Name('John','Doe')
will throw an exception with messagenot a constructor
.Great library btw, I like the custom allocator feature, which matched my use case perfectly.