The enumerator callback returns what is used for eg
Object.getOwnPropertyNames(queryObj)

If you want queryObj["foo"] to return an array, just create on in the
getter callback and set it as return value. The getter takes a
PropertyCallbackInfo<Value> and Array drives from Value

Best
Jochen

Abhishek Singh <[email protected]> schrieb am Mi., 29. Juni 2016,
05:40:

> I'm exposing C++ objects in javascript as a map using
> NamedPropertyHandlerConfiguration. So operations like below in javascript
> are intercepted by Getter/Setter/Deleter callbacks as defined in v8 binding
> code.
>
> var obj = beer-sample["test_key2"]; // "beer-sample" is the keyword I'm
> exposing to JS from v8 binding code, it's encapsulating a C++ object
> beer-sample["test_key1"] = "test_value1";
> delete beer-sample["test_key3"];
>
> Next step in this use-case I'm looking at is to enumerate result-set
> obtained. I've looked at GenericNamedPropertyEnumeratorCallback but that
> doesn't look to be helpful in this case. Signature looks like below:
>
> void GenericNamedPropertyEnumeratorCallback(PropertyCallbackInfo<Array>&
> info);
>
> It doesn't allow to pass Local<Name> property to it like
> Getter/Setter/Deleter callback and I understand Enumerator Callback's
> purpose is different by looking at the unit tests within V8 code.
>
> ===
>
> Here is what I'm specifically after:
>
> In javascript a user could write something like this:
>
> ```
> var queryResult = queryObj["select * from `beer-sample`;"]
>
> var resultLength = queryResult.length;
>
> for (var i = 0; i < resultLength; i++) {
>    //Do some computation and bookkeeping on each row
>    log(queryResult[i]);
> }
> ```
>
> So queryResult needs to of type PropertyCallbackInfo<Array> type and I'm
> not sure correct way to do this. What would be the recommended to achieve
> this?
>
> Thanks,
> Abhishek
> --
> Thanks,
>
> Abhishek Singh
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to