#pragma once #include #include #include #include #include "generic/error.h" namespace ivm { /** * Easy strings */ inline auto v8_string(const char* string) -> v8::Local { return Unmaybe(v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), (const uint8_t*)string, v8::NewStringType::kNormal)); // NOLINT } inline auto v8_symbol(const char* string) -> v8::Local { return Unmaybe(v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), (const uint8_t*)string, v8::NewStringType::kInternalized)); // NOLINT } /** * Shorthand dereference of Persistent to Local */ template auto Deref(const v8::Persistent& handle) -> v8::Local { return v8::Local::New(v8::Isolate::GetCurrent(), handle); } template auto Deref(const v8::Global& handle) -> v8::Local { return v8::Local::New(v8::Isolate::GetCurrent(), handle); } } #include "remote_handle.h" namespace ivm { template auto Deref(const RemoteHandle& handle) -> v8::Local { return handle.Deref(); } } // namespace ivm