Is it possible to create some enum in C++ code of Node.js addon and then expose this type to js code? I found that native enum types exist in js, but there's no information about their implementation in v8 engine.
There is no specific enum types in javascript, instead use constant int for that, such as in web, properties UNSENT,OPENED, HEADERS_RECEIVED,LOADING,DONE of XMLHttpRequest are defined as enum type in C++. To export these properties in v8 for javascript, use like:
Local<Object> obj;
const char* k = "HEADERS_RECEIVED";
int v = 1;
obj->Set(v8::String::NewSymbol(k), v8::Int32::New(v), ReadOnly); // Use PropertyAttribute ReadOnly so that value won't be changed by javascript.