[quickjs-devel] Re: Create a new instance of the class using name

  • From: JM <jeevhi@xxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Sun, 26 Jan 2020 20:00:01 +0530

thank you. that worked.

How to set the value of class members.  I attempted using JS_SetPropertyStr
but it does not invoke set function of the class defined using
JS_CGETSET_MAGIC_DEF.



On Sat, Jan 25, 2020 at 5:41 PM Ondřej Jirman <deibeemoocheuguhumoh@xxxxxx>
wrote:

On Sat, Jan 25, 2020 at 03:31:39PM +0530, JM wrote:
Since I didn't receive any answer, I assume there is no CAPI to do this.
Is
it a correct assumption?

You need to do it in more steps:

1) get global object
2) get property named 'YourClass'
3) create an instance by calling JS_CallConstructor on reference to
YourClass
   from 2)

        o.



On Thu, Jan 23, 2020 at 4:37 PM JM <jeevhi@xxxxxxxxx> wrote:

How to create an instance of a class using the class name (and not the
class id). I couldn't find any function to achieve this.

Can someone point me to the right function?







Other related posts: