You have to look up the nested path individually, i.e. first JSON,
then hpack, i.e.

Handle<Function> hpack =
    
context->Global()->Get(String::New("JSON")).As<Object>()->Get(String::New("hpack")).As<Function>();

See also the thread starting here:
https://groups.google.com/forum/#!msg/v8-users/X1Dtpkgm6eA/sqwmpFDx8s8J

Matthias


On Thu, Jul 12, 2012 at 7:11 AM, Charles Han
<[email protected]> wrote:
> Hi,
>
> I am trying to use a third party javascript lib in my C++ app. The
> javascript lib named HPACK.json has anonymous function like this:
>
> (function(cache){
>  (this.JSON || (JSON = {})).hpack = function(collection, compression){ ...};
> })([]);
>
> I have tried with this code using V8 but no luck:
> //Load the javascript into the V8 handle already
> Handle<String> foo_name = String::New("json.hpack");
> Handle<Value> foo_val = context->Global()->Get(foo_name);
>
> How can I get access to this function in my C++ code?
>
> Thanks
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to