Files
JiboSDK/node_modules/nan/doc/v8_misc.md
2026-03-22 03:21:45 +02:00

2.0 KiB

Miscellaneous V8 Helpers

Nan::Utf8String

Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object.

An implementation of v8::String::Utf8Value that is consistent across all supported versions of V8.

Definition:

class Nan::Utf8String {
 public:
  Nan::Utf8String(v8::Local<v8::Value> from);

  int length() const;

  char* operator*();
  const char* operator*() const;
};

Nan::GetCurrentContext()

A call to v8::Isolate::GetCurrent()->GetCurrentContext() that works across all supported versions of V8.

Signature:

v8::Local<v8::Context> Nan::GetCurrentContext()

Nan::SetIsolateData()

A helper to provide a consistent API to v8::Isolate#SetData().

Signature:

void Nan::SetIsolateData(v8::Isolate *isolate, T *data)

Nan::GetIsolateData()

A helper to provide a consistent API to v8::Isolate#GetData().

Signature:

T *Nan::GetIsolateData(v8::Isolate *isolate)