NAN provides a v8::Script
helpers as the API has changed over the supported versions of V8.
A wrapper around v8::Script::Compile()
.
Note that Nan::BoundScript
is an alias for v8::Script
.
Signature:
Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(
v8::Local<v8::String> s,
const v8::ScriptOrigin& origin);
Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(v8::Local<v8::String> s);
Calls script->Run()
or script->BindToCurrentContext()->Run(Nan::GetCurrentContext())
.
Note that Nan::BoundScript
is an alias for v8::Script
and Nan::UnboundScript
is an alias for v8::UnboundScript
where available and v8::Script
on older versions of V8.
Signature:
Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::UnboundScript> script)
Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::BoundScript> script)