Giter Site home page Giter Site logo

Comments (3)

beest avatar beest commented on July 23, 2024

@stesie this is an interesting one!

I'm not sure what the mechanism is to expose a constructor to JS via the V8 engine. I'd guess this hasn't been covered in the current V8JS code, so this is likely to be a feature that isn't covered yet rather than a bug.

from v8js.

stesie avatar stesie commented on July 23, 2024

Actually I don't mind if we call this a bug or feature or just issue. After all I stumbled over it, I actually don't need it, but for the moment just wanted to write it down since it crashes the process ...

I guess we can't directly expose the constructor of the PHP class. The v8::FunctionTemplate however has a SetCallHandler method, which according to the API reference

Set the call-handler callback for a FunctionTemplate. This callback is called whenever the function created from this FunctionTemplate is called.

The v8::Arguments passed to the callback function then has a boolean property IsConstructCall, ... which probably is set to true. But haven't done any testing on that.

In that particular case we probably have to create a PHP class instance from v8js, running the PHP class'es __construct function and attach a pointer to the newly allocated PHP class instance to v8's internal field.

I think I'll have a go to implement that the upcoming days, but will concentrate on issue #13 before, as that's more of a show-stopper to me :-)

from v8js.

stesie avatar stesie commented on July 23, 2024

hey there,

just wanted to let you know that I've started working on a fix to this issue. I already got it working basically, current version at https://github.com/stesie/v8js/commits/fix-constructor-call

cheers,
stesie

from v8js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.