Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:40:55+00:00 2026-06-13T22:40:55+00:00

sorry my english is poor, hope someone can understand what I said the code

  • 0

sorry my english is poor, hope someone can understand what I said
the code like this

 class Point
 {
 public:
int x_, y_;
Point(int x, int y):x_(x), y_(y){}
void Test(Local<Object> & obj)
{
    //Local<Value> value = ref->Get(String::New("onconnect"));

    printf("%d", ref->Get(String::New("getX")));
}
 };


 Handle<Value> PointConstructor(const Arguments& args)
 { 

     Point *p = new Point(x, y);

     object->SetInternalField(0, External::New(p));

     p->Test();
     return object; 
 } 

 ...

 Handle<String> script = String::New("var p = new Point(20, 0); p.onconnect = function(){}; log(p.getX())");


   Handle<Script> compiled_script = Script::Compile(script);

method “Test” mybe a async call, run in anthor thread, when it run completed i what call the js method”onconnect”
how can i invoke the js mothod:onconnect in method Test()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:40:56+00:00Added an answer on June 13, 2026 at 10:40 pm

    I write this from memory, some types or calls may be slightly different. Assuming Test receives the Point reference:

    void Test(Local<Object> obj)
    {
       String funName = String::New("onconnect");
       if (obj->Has(funName)){
         Local<Value> fun = obj->Get(funName);
         // would suggest to check additionally whether it actually is a function
         Local<Value> args[] = {}; // empty arguments
         Local<Value> result = fun->AsObject()->CallAsFunction(obj, 0, args);
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code!(sorry for my poor english) #include<stdio.h> int convert(char ch); int main(void)
sorry for my poor english - I'm using EF 5 (Code First) in an
Sorry ,my English is poor, I have never speak English after I leave the
First, I am really sorry for my poor english. Now when I use Ext.List
Sorry for my English. How I can add comment to Jpeg file to COM-marker
Sorry for bad English :( Suppose i can preliminary organize recipes and ingredients data
At first sorry my bad English. I want define routing for this url: For
at first sorry about my poor English. Now Im having a problem in closing
Sorry for my poor english, I'm french ! The first li is already in
First: sorry for my poor English writing. I remember that in VB6.0 days, we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.