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 * This property descriptor is immutable except for its properties enumerable | |
3631 * and configurable. An invalid descriptor that is both | |
3632 * a data and accessor descriptor can not be generated. To determine if | |
3633 * a descriptor is an accessor, data, or generic descriptor, use the | |
3634 * `has_x()` functions for appropriate x. | |
3635 * | |
3636 * Accessors `get` or `set` must be callable, unless they are undefined. Use | |
3637 * empty handles to indicate that `value`, `get`, or `set` are not set. | |
3638 * | |
3639 * \code | |
3640 * PropertyDescriptor(Local<Function>())) // var desc = {} | |
3641 * PropertyDescriptor(v8::Undefined(isolate)) // var desc = {get: undefined} | |
3642 * \endcode | |
3643 */ | |
3644 class V8_EXPORT PropertyDescriptor { | |
3645 public: | |
3646 enum State { kTrue = 0, kFalse = 1, kNotSet = 2 }; | |
3647 | |
3648 // GenericDescriptor | |
3649 PropertyDescriptor(); | |
3650 | |
3651 // DataDescriptor | |
3652 PropertyDescriptor(Local<Value> value, State writable); | |
3653 | |
3654 // AccessorDescriptor | |
3655 PropertyDescriptor(Local<Value> get, Local<Value> set); | |
3656 | |
3657 ~PropertyDescriptor(); | |
3658 | |
3659 Local<Value> value() const; | |
3660 bool has_value() const; | |
3661 | |
3662 Local<Value> get() const; | |
3663 bool has_get() const; | |
3664 Local<Value> set() const; | |
3665 bool has_set() const; | |
3666 | |
3667 void set_enumerable(bool enumerable); | |
3668 State enumerable() const; | |
Jakob Kummerow
2016/08/29 12:32:23
I'd be fine with a "bool enumerable() / bool has_e
Franzi
2016/08/31 09:44:13
As discussed, I'm using bool instead of the enum S
| |
3669 | |
3670 void set_configurable(bool configurable); | |
3671 State configurable() const; | |
3672 | |
3673 State writable() const; | |
3674 | |
3675 PropertyDescriptor(const PropertyDescriptor&) = delete; | |
3676 void operator=(const PropertyDescriptor&) = delete; | |
3677 | |
3678 private: | |
3679 struct PrivateData; | |
3680 PrivateData* private_; | |
3681 }; | |
3611 | 3682 |
3612 /** | 3683 /** |
3613 * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, | 3684 * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, |
3614 * 26.2.1). | 3685 * 26.2.1). |
3615 */ | 3686 */ |
3616 class V8_EXPORT Proxy : public Object { | 3687 class V8_EXPORT Proxy : public Object { |
3617 public: | 3688 public: |
3618 Local<Object> GetTarget(); | 3689 Local<Object> GetTarget(); |
3619 Local<Value> GetHandler(); | 3690 Local<Value> GetHandler(); |
3620 bool IsRevoked(); | 3691 bool IsRevoked(); |
(...skipping 5612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9233 */ | 9304 */ |
9234 | 9305 |
9235 | 9306 |
9236 } // namespace v8 | 9307 } // namespace v8 |
9237 | 9308 |
9238 | 9309 |
9239 #undef TYPE_CHECK | 9310 #undef TYPE_CHECK |
9240 | 9311 |
9241 | 9312 |
9242 #endif // INCLUDE_V8_H_ | 9313 #endif // INCLUDE_V8_H_ |
OLD | NEW |