FunctionCallbackInfo: This, Holder and Callee.

624 views
Skip to first unread message

Jane Chen

unread,
Sep 12, 2014, 4:25:01 AM9/12/14
to v8-u...@googlegroups.com
What's the difference between This() and Holder() in FunctionCallbackInfo?  What does Callee() return?  Can you show it with a JavaScript example?

Thanks!

Ben Noordhuis

unread,
Sep 12, 2014, 2:40:02 PM9/12/14
to v8-u...@googlegroups.com
On Fri, Sep 12, 2014 at 6:25 AM, Jane Chen <jxch...@gmail.com> wrote:
> What's the difference between This() and Holder() in FunctionCallbackInfo?
> What does Callee() return? Can you show it with a JavaScript example?

.Callee() is the JS function that called your API function. It's
equivalent to the (deprecated) arguments.callee property.

.This() and .Holder() are often identical. The only time (that I know
of) when they are different is when instantiating objects that have a
prototypical inheritance chain:

function F() {}
F.prototype = g;
var f = new F;
f.x = 42;

Assume |g| is instantiated from an ObjectTemplate with a setter for
|x|. The last line invokes the setter with .This() pointing to |f|
and .Holder() pointing to |g|.

Mike Schwartz

unread,
Sep 12, 2014, 3:13:19 PM9/12/14
to v8-u...@googlegroups.com
Callee is the "currently executing function" according to JavaScript 1.2 / ECMA 3



--
--
v8-users mailing list
v8-u...@googlegroups.com
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 v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages