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 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3252 static const int kDataIndex = 5; | 3252 static const int kDataIndex = 5; |
3253 static const int kThisIndex = 6; | 3253 static const int kThisIndex = 6; |
3254 | 3254 |
3255 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} | 3255 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} |
3256 internal::Object** args_; | 3256 internal::Object** args_; |
3257 }; | 3257 }; |
3258 | 3258 |
3259 | 3259 |
3260 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); | 3260 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); |
3261 | 3261 |
| 3262 enum class ConstructorBehavior { kThrow, kAllow }; |
3262 | 3263 |
3263 /** | 3264 /** |
3264 * A JavaScript function object (ECMA-262, 15.3). | 3265 * A JavaScript function object (ECMA-262, 15.3). |
3265 */ | 3266 */ |
3266 class V8_EXPORT Function : public Object { | 3267 class V8_EXPORT Function : public Object { |
3267 public: | 3268 public: |
3268 /** | 3269 /** |
3269 * Create a function in the current execution context | 3270 * Create a function in the current execution context |
3270 * for a given FunctionCallback. | 3271 * for a given FunctionCallback. |
3271 */ | 3272 */ |
3272 static MaybeLocal<Function> New(Local<Context> context, | 3273 static MaybeLocal<Function> New( |
3273 FunctionCallback callback, | 3274 Local<Context> context, FunctionCallback callback, |
3274 Local<Value> data = Local<Value>(), | 3275 Local<Value> data = Local<Value>(), int length = 0, |
3275 int length = 0); | 3276 ConstructorBehavior behavior = ConstructorBehavior::kAllow); |
3276 static V8_DEPRECATE_SOON( | 3277 static V8_DEPRECATE_SOON( |
3277 "Use maybe version", | 3278 "Use maybe version", |
3278 Local<Function> New(Isolate* isolate, FunctionCallback callback, | 3279 Local<Function> New(Isolate* isolate, FunctionCallback callback, |
3279 Local<Value> data = Local<Value>(), int length = 0)); | 3280 Local<Value> data = Local<Value>(), int length = 0)); |
3280 | 3281 |
3281 V8_DEPRECATED("Use maybe version", | 3282 V8_DEPRECATED("Use maybe version", |
3282 Local<Object> NewInstance(int argc, Local<Value> argv[]) const); | 3283 Local<Object> NewInstance(int argc, Local<Value> argv[]) const); |
3283 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance( | 3284 V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance( |
3284 Local<Context> context, int argc, Local<Value> argv[]) const; | 3285 Local<Context> context, int argc, Local<Value> argv[]) const; |
3285 | 3286 |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4486 * child_instance.instance_accessor calls 'InstanceAccessorCallback' | 4487 * child_instance.instance_accessor calls 'InstanceAccessorCallback' |
4487 * child_instance.instance_property == 3; | 4488 * child_instance.instance_property == 3; |
4488 * \endcode | 4489 * \endcode |
4489 */ | 4490 */ |
4490 class V8_EXPORT FunctionTemplate : public Template { | 4491 class V8_EXPORT FunctionTemplate : public Template { |
4491 public: | 4492 public: |
4492 /** Creates a function template.*/ | 4493 /** Creates a function template.*/ |
4493 static Local<FunctionTemplate> New( | 4494 static Local<FunctionTemplate> New( |
4494 Isolate* isolate, FunctionCallback callback = 0, | 4495 Isolate* isolate, FunctionCallback callback = 0, |
4495 Local<Value> data = Local<Value>(), | 4496 Local<Value> data = Local<Value>(), |
4496 Local<Signature> signature = Local<Signature>(), int length = 0); | 4497 Local<Signature> signature = Local<Signature>(), int length = 0, |
| 4498 ConstructorBehavior behavior = ConstructorBehavior::kAllow); |
4497 | 4499 |
4498 /** Get a template included in the snapshot by index. */ | 4500 /** Get a template included in the snapshot by index. */ |
4499 static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate, | 4501 static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate, |
4500 size_t index); | 4502 size_t index); |
4501 | 4503 |
4502 /** | 4504 /** |
4503 * Creates a function template with a fast handler. If a fast handler is set, | 4505 * Creates a function template with a fast handler. If a fast handler is set, |
4504 * the callback cannot be null. | 4506 * the callback cannot be null. |
4505 */ | 4507 */ |
4506 static Local<FunctionTemplate> NewWithFastHandler( | 4508 static Local<FunctionTemplate> NewWithFastHandler( |
(...skipping 4405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8912 */ | 8914 */ |
8913 | 8915 |
8914 | 8916 |
8915 } // namespace v8 | 8917 } // namespace v8 |
8916 | 8918 |
8917 | 8919 |
8918 #undef TYPE_CHECK | 8920 #undef TYPE_CHECK |
8919 | 8921 |
8920 | 8922 |
8921 #endif // INCLUDE_V8_H_ | 8923 #endif // INCLUDE_V8_H_ |
OLD | NEW |