@@ -137,7 +137,7 @@ function getFoo(obj) {
137
137
}
138
138
```
139
139
140
- ``` c++
140
+ ``` cpp
141
141
v8::Local<v8::Value> GetFoo (v8::Local< v8::Context > context,
142
142
v8::Local< v8::Object > obj) {
143
143
v8::Isolate* isolate = context->GetIsolate();
@@ -168,7 +168,7 @@ See [exception handling][] for more information about the usage of `.To()`,
168
168
If it is known that a `Local<Value>` refers to a more specific type, it can
169
169
be cast to that type using `.As<...>()`:
170
170
171
- ```c++
171
+ ```cpp
172
172
v8::Local<v8::Value> some_value;
173
173
// CHECK() is a Node.js utilitity that works similar to assert().
174
174
CHECK(some_value->IsUint8Array());
@@ -201,7 +201,7 @@ alive even if no other objects refer to them. Weak global handles do not do
201
201
that, and instead optionally call a callback when the object they refer to
202
202
is garbage-collected.
203
203
204
- ``` c++
204
+ ``` cpp
205
205
v8::Global<v8::Object> reference;
206
206
207
207
void StoreReference (v8::Isolate* isolate, v8::Local< v8::Object > obj) {
@@ -329,7 +329,7 @@ The platform can be accessed through `isolate_data->platform()` given an
329
329
C++ functions exposed to JS follow a specific signature. The following example
330
330
is from `node_util.cc`:
331
331
332
- ```c++
332
+ ```cpp
333
333
void ArrayBufferViewHasBuffer(const FunctionCallbackInfo<Value>& args) {
334
334
CHECK(args[0]->IsArrayBufferView());
335
335
args.GetReturnValue().Set(args[0].As<ArrayBufferView>()->HasBuffer());
@@ -351,7 +351,7 @@ floating-point number or a `Local<Value>` to set the return value.
351
351
Node.js provides various helpers for building JS classes in C++ and/or attaching
352
352
C++ functions to the exports of a built-in module:
353
353
354
- ``` c++
354
+ ``` cpp
355
355
void Initialize (Local<Object > target,
356
356
Local<Value > unused,
357
357
Local<Context > context,
@@ -473,7 +473,7 @@ to perform further calls to APIs that return `Maybe`s.
473
473
A typical pattern for dealing with APIs that return `Maybe` and `MaybeLocal` is
474
474
using `.ToLocal()` and `.To()` and returning early in case there is an error:
475
475
476
- ```c++
476
+ ```cpp
477
477
// This could also return a v8::MaybeLocal<v8::Number>, for example.
478
478
v8::Maybe<double> SumNumbers(v8::Local<v8::Context> context,
479
479
v8::Local<v8::Array> array_of_integers) {
@@ -642,7 +642,7 @@ A helper for this is the `ASSIGN_OR_RETURN_UNWRAP` macro that returns from the
642
642
current function if unwrapping fails (typically that means that the ` BaseObject `
643
643
has been deleted earlier).
644
644
645
- ``` c++
645
+ ``` cpp
646
646
void Http2Session::Request (const FunctionCallbackInfo<Value >& args) {
647
647
Http2Session* session;
648
648
ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
@@ -730,7 +730,7 @@ queues once it returns.
730
730
Before calling `MakeCallback()`, it is typically necessary to enter both a
731
731
`HandleScope` and a `Context::Scope`.
732
732
733
- ```c++
733
+ ```cpp
734
734
void StatWatcher::Callback(uv_fs_poll_t* handle,
735
735
int status,
736
736
const uv_stat_t* prev,
@@ -822,7 +822,7 @@ The `Utf8Value`, `TwoByteValue` (i.e. UTF-16 value) and `BufferValue`
822
822
inherit from this class and allow accessing the characters in a JavaScript
823
823
string this way.
824
824
825
- ``` c++
825
+ ``` cpp
826
826
static void Chdir (const FunctionCallbackInfo<Value >& args) {
827
827
Environment* env = Environment::GetCurrent(args);
828
828
// ...
0 commit comments