Chromium Code Reviews| 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 4399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4410 * used to create object instances when the function is used as a | 4410 * used to create object instances when the function is used as a |
| 4411 * constructor. Properties added to the instance template are added to | 4411 * constructor. Properties added to the instance template are added to |
| 4412 * each object instance. | 4412 * each object instance. |
| 4413 * | 4413 * |
| 4414 * A FunctionTemplate can have a prototype template. The prototype template | 4414 * A FunctionTemplate can have a prototype template. The prototype template |
| 4415 * is used to create the prototype object of the function. | 4415 * is used to create the prototype object of the function. |
| 4416 * | 4416 * |
| 4417 * The following example shows how to use a FunctionTemplate: | 4417 * The following example shows how to use a FunctionTemplate: |
| 4418 * | 4418 * |
| 4419 * \code | 4419 * \code |
| 4420 * v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(); | 4420 * v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate); |
| 4421 * t->Set("func_property", v8::Number::New(1)); | 4421 * t->Set(isolate, "func_property", v8::Number::New(isolate, 1)); |
| 4422 * | 4422 * |
| 4423 * v8::Local<v8::Template> proto_t = t->PrototypeTemplate(); | 4423 * v8::Local<v8::Template> proto_t = t->PrototypeTemplate(); |
| 4424 * proto_t->Set("proto_method", v8::FunctionTemplate::New(InvokeCallback)); | 4424 * proto_t->Set(isolate, "proto_method", v8::FunctionTemplate::New(isolate, I nvokeCallback)); |
|
danno
2016/07/06 09:17:46
You will need to reformat by hand, since this line
| |
| 4425 * proto_t->Set("proto_const", v8::Number::New(2)); | 4425 * proto_t->Set(isolate, "proto_const", v8::Number::New(isolate, 2)); |
| 4426 * | 4426 * |
| 4427 * v8::Local<v8::ObjectTemplate> instance_t = t->InstanceTemplate(); | 4427 * v8::Local<v8::ObjectTemplate> instance_t = t->InstanceTemplate(); |
| 4428 * instance_t->SetAccessor("instance_accessor", InstanceAccessorCallback); | 4428 * instance_t->SetAccessor(String::NewFromUtf8(isolate, "instance_accessor"), InstanceAccessorCallback); |
| 4429 * instance_t->SetNamedPropertyHandler(PropertyHandlerCallback, ...); | 4429 * instance_t->SetNamedPropertyHandler(PropertyHandlerCallback); |
| 4430 * instance_t->Set("instance_property", Number::New(3)); | 4430 * instance_t->Set(String::NewFromUtf8(isolate, "instance_property"), Number: :New(isolate, 3)); |
| 4431 * | 4431 * |
| 4432 * v8::Local<v8::Function> function = t->GetFunction(); | 4432 * v8::Local<v8::Function> function = t->GetFunction(); |
| 4433 * v8::Local<v8::Object> instance = function->NewInstance(); | 4433 * v8::Local<v8::Object> instance = function->NewInstance(); |
| 4434 * \endcode | 4434 * \endcode |
| 4435 * | 4435 * |
| 4436 * Let's use "function" as the JS variable name of the function object | 4436 * Let's use "function" as the JS variable name of the function object |
| 4437 * and "instance" for the instance object created above. The function | 4437 * and "instance" for the instance object created above. The function |
| 4438 * and the instance will have the following properties: | 4438 * and the instance will have the following properties: |
| 4439 * | 4439 * |
| 4440 * \code | 4440 * \code |
| (...skipping 4471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8912 */ | 8912 */ |
| 8913 | 8913 |
| 8914 | 8914 |
| 8915 } // namespace v8 | 8915 } // namespace v8 |
| 8916 | 8916 |
| 8917 | 8917 |
| 8918 #undef TYPE_CHECK | 8918 #undef TYPE_CHECK |
| 8919 | 8919 |
| 8920 | 8920 |
| 8921 #endif // INCLUDE_V8_H_ | 8921 #endif // INCLUDE_V8_H_ |
| OLD | NEW |