-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example of C class extending JS class #333
Comments
IIRC the Buffer class extends Uint8Array. Anyway. I think you can get the prototype with JS_GetPrototype and then add your custom methods. |
Yes sorry That would work for the prototype, I probably also need something for the constructor to call the parent one. |
Good point. I'm not sure QuickJS provider the necessary APIs to do that... @chqrlie ? |
I tried to use In reality I am writing that for the rust library rquickjs so I need to massage it a bit more but I didn't want to add complexity to the example. |
Calling constructor on the prototype might work indeed! |
@saghul Sorry, cannot comment right now, travelling 1200 km from the North pole with very little Internet coverage :) |
@chqrlie If you have time, still looking for guidance on it |
Hi!
Does someone have an example of a C class extending a JS class?
Essentially the inverse of the
Point
example.I am trying to re-create the node
Buffer
class in C and I want to extend theArrayBuffer
class.Thanks
The text was updated successfully, but these errors were encountered: