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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 class Maybe; | 89 class Maybe; |
90 class Name; | 90 class Name; |
91 class Number; | 91 class Number; |
92 class NumberObject; | 92 class NumberObject; |
93 class Object; | 93 class Object; |
94 class ObjectOperationDescriptor; | 94 class ObjectOperationDescriptor; |
95 class ObjectTemplate; | 95 class ObjectTemplate; |
96 class Platform; | 96 class Platform; |
97 class Primitive; | 97 class Primitive; |
98 class Promise; | 98 class Promise; |
| 99 class PropertyDescriptor; |
99 class Proxy; | 100 class Proxy; |
100 class RawOperationDescriptor; | 101 class RawOperationDescriptor; |
101 class Script; | 102 class Script; |
102 class SharedArrayBuffer; | 103 class SharedArrayBuffer; |
103 class Signature; | 104 class Signature; |
104 class StartupData; | 105 class StartupData; |
105 class StackFrame; | 106 class StackFrame; |
106 class StackTrace; | 107 class StackTrace; |
107 class String; | 108 class String; |
108 class StringObject; | 109 class StringObject; |
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2784 // Implements DefineOwnProperty. | 2785 // Implements DefineOwnProperty. |
2785 // | 2786 // |
2786 // In general, CreateDataProperty will be faster, however, does not allow | 2787 // In general, CreateDataProperty will be faster, however, does not allow |
2787 // for specifying attributes. | 2788 // for specifying attributes. |
2788 // | 2789 // |
2789 // Returns true on success. | 2790 // Returns true on success. |
2790 V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty( | 2791 V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty( |
2791 Local<Context> context, Local<Name> key, Local<Value> value, | 2792 Local<Context> context, Local<Name> key, Local<Value> value, |
2792 PropertyAttribute attributes = None); | 2793 PropertyAttribute attributes = None); |
2793 | 2794 |
| 2795 // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4. |
| 2796 // |
| 2797 // The defineProperty function is used to add an own property or |
| 2798 // update the attributes of an existing own property of an object. |
| 2799 // |
| 2800 // Both data and accessor descriptors can be used. |
| 2801 // |
| 2802 // In general, CreateDataProperty is faster, however, does not allow |
| 2803 // for specifying attributes or an accessor descriptor. |
| 2804 // |
| 2805 // Returns true on success. |
| 2806 V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty( |
| 2807 Local<Context> context, Local<Name> key, |
| 2808 const PropertyDescriptor& descriptor); |
| 2809 |
2794 // Sets an own property on this object bypassing interceptors and | 2810 // Sets an own property on this object bypassing interceptors and |
2795 // overriding accessors or read-only properties. | 2811 // overriding accessors or read-only properties. |
2796 // | 2812 // |
2797 // Note that if the object has an interceptor the property will be set | 2813 // Note that if the object has an interceptor the property will be set |
2798 // locally, but since the interceptor takes precedence the local property | 2814 // locally, but since the interceptor takes precedence the local property |
2799 // will only be returned if the interceptor doesn't return a value. | 2815 // will only be returned if the interceptor doesn't return a value. |
2800 // | 2816 // |
2801 // Note also that this only works for named properties. | 2817 // Note also that this only works for named properties. |
2802 V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty", | 2818 V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty", |
2803 bool ForceSet(Local<Value> key, Local<Value> value, | 2819 bool ForceSet(Local<Value> key, Local<Value> value, |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3601 */ | 3617 */ |
3602 bool HasHandler(); | 3618 bool HasHandler(); |
3603 | 3619 |
3604 V8_INLINE static Promise* Cast(Value* obj); | 3620 V8_INLINE static Promise* Cast(Value* obj); |
3605 | 3621 |
3606 private: | 3622 private: |
3607 Promise(); | 3623 Promise(); |
3608 static void CheckCast(Value* obj); | 3624 static void CheckCast(Value* obj); |
3609 }; | 3625 }; |
3610 | 3626 |
| 3627 /** |
| 3628 * An instance of a Property Descriptor, see Ecma-262 6.2.4. |
| 3629 * |
| 3630 * Properties in a descriptor are present or absent. If you do not set |
| 3631 * `enumerable`, `configurable`, and `writable`, they are absent. If `value`, |
| 3632 * `get`, or `set` are absent, but you must specify them in the constructor, use |
| 3633 * empty handles. |
| 3634 * |
| 3635 * Accessors `get` and `set` must be callable or undefined if they are present. |
| 3636 * |
| 3637 * An instance of this property descriptor is immutable except for its |
| 3638 * properties `enumerable` and `configurable`. |
| 3639 * |
| 3640 * \note Only query properties if they are present, i.e., call `x()` only if |
| 3641 * `has_x()` returns true. |
| 3642 * |
| 3643 * \code |
| 3644 * // var desc = {writable: false} |
| 3645 * v8::PropertyDescriptor d(Local<Value>()), false); |
| 3646 * d.value(); // error, value not set |
| 3647 * if (d.has_writable()) { |
| 3648 * d.writable(); // false |
| 3649 * } |
| 3650 * |
| 3651 * // var desc = {value: undefined} |
| 3652 * v8::PropertyDescriptor d(v8::Undefined(isolate)); |
| 3653 * |
| 3654 * // var desc = {get: undefined} |
| 3655 * v8::PropertyDescriptor d(v8::Undefined(isolate), Local<Value>())); |
| 3656 * \endcode |
| 3657 */ |
| 3658 class V8_EXPORT PropertyDescriptor { |
| 3659 public: |
| 3660 // GenericDescriptor |
| 3661 PropertyDescriptor(); |
| 3662 |
| 3663 // DataDescriptor |
| 3664 PropertyDescriptor(Local<Value> value); |
| 3665 |
| 3666 // DataDescriptor with writable property |
| 3667 PropertyDescriptor(Local<Value> value, bool writable); |
| 3668 |
| 3669 // AccessorDescriptor |
| 3670 PropertyDescriptor(Local<Value> get, Local<Value> set); |
| 3671 |
| 3672 ~PropertyDescriptor(); |
| 3673 |
| 3674 Local<Value> value() const; |
| 3675 bool has_value() const; |
| 3676 |
| 3677 Local<Value> get() const; |
| 3678 bool has_get() const; |
| 3679 Local<Value> set() const; |
| 3680 bool has_set() const; |
| 3681 |
| 3682 void set_enumerable(bool enumerable); |
| 3683 bool enumerable() const; |
| 3684 bool has_enumerable() const; |
| 3685 |
| 3686 void set_configurable(bool configurable); |
| 3687 bool configurable() const; |
| 3688 bool has_configurable() const; |
| 3689 |
| 3690 bool writable() const; |
| 3691 bool has_writable() const; |
| 3692 |
| 3693 PropertyDescriptor(const PropertyDescriptor&) = delete; |
| 3694 void operator=(const PropertyDescriptor&) = delete; |
| 3695 |
| 3696 private: |
| 3697 struct PrivateData; |
| 3698 PrivateData* private_; |
| 3699 }; |
3611 | 3700 |
3612 /** | 3701 /** |
3613 * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, | 3702 * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, |
3614 * 26.2.1). | 3703 * 26.2.1). |
3615 */ | 3704 */ |
3616 class V8_EXPORT Proxy : public Object { | 3705 class V8_EXPORT Proxy : public Object { |
3617 public: | 3706 public: |
3618 Local<Object> GetTarget(); | 3707 Local<Object> GetTarget(); |
3619 Local<Value> GetHandler(); | 3708 Local<Value> GetHandler(); |
3620 bool IsRevoked(); | 3709 bool IsRevoked(); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4466 /** | 4555 /** |
4467 * Returns an array containing the names of the properties the named | 4556 * Returns an array containing the names of the properties the named |
4468 * property getter intercepts. | 4557 * property getter intercepts. |
4469 */ | 4558 */ |
4470 typedef void (*NamedPropertyEnumeratorCallback)( | 4559 typedef void (*NamedPropertyEnumeratorCallback)( |
4471 const PropertyCallbackInfo<Array>& info); | 4560 const PropertyCallbackInfo<Array>& info); |
4472 | 4561 |
4473 | 4562 |
4474 // TODO(dcarney): Deprecate and remove previous typedefs, and replace | 4563 // TODO(dcarney): Deprecate and remove previous typedefs, and replace |
4475 // GenericNamedPropertyFooCallback with just NamedPropertyFooCallback. | 4564 // GenericNamedPropertyFooCallback with just NamedPropertyFooCallback. |
| 4565 |
4476 /** | 4566 /** |
4477 * Interceptor for get requests on an object. | 4567 * Interceptor for get requests on an object. |
4478 * | 4568 * |
4479 * Use `info.GetReturnValue().Set()` to set the return value of the | 4569 * Use `info.GetReturnValue().Set()` to set the return value of the |
4480 * intercepted get request. | 4570 * intercepted get request. |
4481 * | 4571 * |
4482 * \param property The name of the property for which the request was | 4572 * \param property The name of the property for which the request was |
4483 * intercepted. | 4573 * intercepted. |
4484 * \param info Information about the intercepted request, such as | 4574 * \param info Information about the intercepted request, such as |
4485 * isolate, receiver, return value, or whether running in `'use strict`' mode. | 4575 * isolate, receiver, return value, or whether running in `'use strict`' mode. |
(...skipping 4747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9233 */ | 9323 */ |
9234 | 9324 |
9235 | 9325 |
9236 } // namespace v8 | 9326 } // namespace v8 |
9237 | 9327 |
9238 | 9328 |
9239 #undef TYPE_CHECK | 9329 #undef TYPE_CHECK |
9240 | 9330 |
9241 | 9331 |
9242 #endif // INCLUDE_V8_H_ | 9332 #endif // INCLUDE_V8_H_ |
OLD | NEW |