OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3346 | 3346 |
3347 | 3347 |
3348 /** | 3348 /** |
3349 * Returns an array containing the names of the properties the named | 3349 * Returns an array containing the names of the properties the named |
3350 * property getter intercepts. | 3350 * property getter intercepts. |
3351 */ | 3351 */ |
3352 typedef void (*NamedPropertyEnumeratorCallback)( | 3352 typedef void (*NamedPropertyEnumeratorCallback)( |
3353 const PropertyCallbackInfo<Array>& info); | 3353 const PropertyCallbackInfo<Array>& info); |
3354 | 3354 |
3355 | 3355 |
| 3356 // TODO(wingo): Deprecate and remove previous typedefs, and replace |
| 3357 // GenericNamedPropertyFooCallback with just NamedPropertyFooCallback. |
| 3358 /** |
| 3359 * GenericNamedProperty[Getter|Setter] are used as interceptors on object. |
| 3360 * See ObjectTemplate::SetNamedPropertyHandler. |
| 3361 */ |
| 3362 typedef void (*GenericNamedPropertyGetterCallback)( |
| 3363 Local<Name> property, |
| 3364 const PropertyCallbackInfo<Value>& info); |
| 3365 |
| 3366 |
| 3367 /** |
| 3368 * Returns the value if the setter intercepts the request. |
| 3369 * Otherwise, returns an empty handle. |
| 3370 */ |
| 3371 typedef void (*GenericNamedPropertySetterCallback)( |
| 3372 Local<Name> property, |
| 3373 Local<Value> value, |
| 3374 const PropertyCallbackInfo<Value>& info); |
| 3375 |
| 3376 |
| 3377 /** |
| 3378 * Returns a non-empty handle if the interceptor intercepts the request. |
| 3379 * The result is an integer encoding property attributes (like v8::None, |
| 3380 * v8::DontEnum, etc.) |
| 3381 */ |
| 3382 typedef void (*GenericNamedPropertyQueryCallback)( |
| 3383 Local<Name> property, |
| 3384 const PropertyCallbackInfo<Integer>& info); |
| 3385 |
| 3386 |
| 3387 /** |
| 3388 * Returns a non-empty handle if the deleter intercepts the request. |
| 3389 * The return value is true if the property could be deleted and false |
| 3390 * otherwise. |
| 3391 */ |
| 3392 typedef void (*GenericNamedPropertyDeleterCallback)( |
| 3393 Local<Name> property, |
| 3394 const PropertyCallbackInfo<Boolean>& info); |
| 3395 |
| 3396 |
| 3397 /** |
| 3398 * Returns an array containing the names of the properties the named |
| 3399 * property getter intercepts. |
| 3400 */ |
| 3401 typedef void (*GenericNamedPropertyEnumeratorCallback)( |
| 3402 const PropertyCallbackInfo<Array>& info); |
| 3403 |
| 3404 |
3356 /** | 3405 /** |
3357 * Returns the value of the property if the getter intercepts the | 3406 * Returns the value of the property if the getter intercepts the |
3358 * request. Otherwise, returns an empty handle. | 3407 * request. Otherwise, returns an empty handle. |
3359 */ | 3408 */ |
3360 typedef void (*IndexedPropertyGetterCallback)( | 3409 typedef void (*IndexedPropertyGetterCallback)( |
3361 uint32_t index, | 3410 uint32_t index, |
3362 const PropertyCallbackInfo<Value>& info); | 3411 const PropertyCallbackInfo<Value>& info); |
3363 | 3412 |
3364 | 3413 |
3365 /** | 3414 /** |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3667 Handle<AccessorSignature> signature = | 3716 Handle<AccessorSignature> signature = |
3668 Handle<AccessorSignature>()); | 3717 Handle<AccessorSignature>()); |
3669 | 3718 |
3670 /** | 3719 /** |
3671 * Sets a named property handler on the object template. | 3720 * Sets a named property handler on the object template. |
3672 * | 3721 * |
3673 * Whenever a property whose name is a string is accessed on objects created | 3722 * Whenever a property whose name is a string is accessed on objects created |
3674 * from this object template, the provided callback is invoked instead of | 3723 * from this object template, the provided callback is invoked instead of |
3675 * accessing the property directly on the JavaScript object. | 3724 * accessing the property directly on the JavaScript object. |
3676 * | 3725 * |
| 3726 * Note that new code should use the second version that can intercept |
| 3727 * symbol-named properties as well as string-named properties. |
| 3728 * |
3677 * \param getter The callback to invoke when getting a property. | 3729 * \param getter The callback to invoke when getting a property. |
3678 * \param setter The callback to invoke when setting a property. | 3730 * \param setter The callback to invoke when setting a property. |
3679 * \param query The callback to invoke to check if a property is present, | 3731 * \param query The callback to invoke to check if a property is present, |
3680 * and if present, get its attributes. | 3732 * and if present, get its attributes. |
3681 * \param deleter The callback to invoke when deleting a property. | 3733 * \param deleter The callback to invoke when deleting a property. |
3682 * \param enumerator The callback to invoke to enumerate all the named | 3734 * \param enumerator The callback to invoke to enumerate all the named |
3683 * properties of an object. | 3735 * properties of an object. |
3684 * \param data A piece of data that will be passed to the callbacks | 3736 * \param data A piece of data that will be passed to the callbacks |
3685 * whenever they are invoked. | 3737 * whenever they are invoked. |
3686 */ | 3738 */ |
3687 void SetNamedPropertyHandler( | 3739 void SetNamedPropertyHandler( |
3688 NamedPropertyGetterCallback getter, | 3740 NamedPropertyGetterCallback getter, |
3689 NamedPropertySetterCallback setter = 0, | 3741 NamedPropertySetterCallback setter = 0, |
3690 NamedPropertyQueryCallback query = 0, | 3742 NamedPropertyQueryCallback query = 0, |
3691 NamedPropertyDeleterCallback deleter = 0, | 3743 NamedPropertyDeleterCallback deleter = 0, |
3692 NamedPropertyEnumeratorCallback enumerator = 0, | 3744 NamedPropertyEnumeratorCallback enumerator = 0, |
3693 Handle<Value> data = Handle<Value>()); | 3745 Handle<Value> data = Handle<Value>()); |
| 3746 void SetNamedPropertyHandler( |
| 3747 GenericNamedPropertyGetterCallback getter, |
| 3748 GenericNamedPropertySetterCallback setter = 0, |
| 3749 GenericNamedPropertyQueryCallback query = 0, |
| 3750 GenericNamedPropertyDeleterCallback deleter = 0, |
| 3751 GenericNamedPropertyEnumeratorCallback enumerator = 0, |
| 3752 Handle<Value> data = Handle<Value>()); |
3694 | 3753 |
3695 /** | 3754 /** |
3696 * Sets an indexed property handler on the object template. | 3755 * Sets an indexed property handler on the object template. |
3697 * | 3756 * |
3698 * Whenever an indexed property is accessed on objects created from | 3757 * Whenever an indexed property is accessed on objects created from |
3699 * this object template, the provided callback is invoked instead of | 3758 * this object template, the provided callback is invoked instead of |
3700 * accessing the property directly on the JavaScript object. | 3759 * accessing the property directly on the JavaScript object. |
3701 * | 3760 * |
3702 * \param getter The callback to invoke when getting a property. | 3761 * \param getter The callback to invoke when getting a property. |
3703 * \param setter The callback to invoke when setting a property. | 3762 * \param setter The callback to invoke when setting a property. |
(...skipping 3118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6822 */ | 6881 */ |
6823 | 6882 |
6824 | 6883 |
6825 } // namespace v8 | 6884 } // namespace v8 |
6826 | 6885 |
6827 | 6886 |
6828 #undef TYPE_CHECK | 6887 #undef TYPE_CHECK |
6829 | 6888 |
6830 | 6889 |
6831 #endif // V8_H_ | 6890 #endif // V8_H_ |
OLD | NEW |