quickjs icon indicating copy to clipboard operation
quickjs copied to clipboard

Problem with creating new class type from C code and displaying list of props/functions from it.

Open reinholdPL opened this issue 8 months ago • 0 comments

When i'm creating my own class in C code (like in examples/point.c) and using it in QuickJS why can't i see props and functions from it when i'm running java script code? I mean I can access and use them, but when I'm trying to JSON.stringify that object, or assign it to another object data from class data is not visible (or it's lost in case of assign). For e.g. when I run:

import {Point} from "./examples/point.so"; let point = new Point(5,5); console.log("point.x = "+point.x); point.x = 10; console.log("point.x =" + point.x); console.log("point stringified = " + JSON.stringify(point, null,2)); let point2 = Object.assign({}, point); console.log("point2.x = " + point2.x);

result is:

point.x = 5 point.x = 10 point stringified = {} point2.x = undefined

reinholdPL avatar Jun 05 '24 11:06 reinholdPL