程序代写代做代考 compiler ## Script

## Script

NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8.

Nan::CompileScript()
Nan::RunScript()


### Nan::CompileScript()

A wrapper around [`v8::Script::Compile()`](https://v8docs.nodesource.com/io.js-3.0/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b).

Note that `Nan::BoundScript` is an alias for `v8::Script`.

Signature:

“`c++
Nan::MaybeLocal Nan::CompileScript(
v8::Local s,
const v8::ScriptOrigin& origin);
Nan::MaybeLocal Nan::CompileScript(v8::Local s);
“`


### Nan::RunScript()

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:

“`c++
Nan::MaybeLocal Nan::RunScript(v8::Local script)
Nan::MaybeLocal Nan::RunScript(v8::Local script)
“`

Leave a Reply

Your email address will not be published. Required fields are marked *