limepot-xyz/BETA/mybulma/node_modules/nan/doc/script.md
LimePot 76722fec47 Beta Site
Going to slowly work on a Bulma site, which will end up being the main site.

Currently under the /BETA/ folder so Alpha site will still be main site.
2022-12-20 16:23:37 -07:00

2 KiB

Script

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

Nan::CompileScript()

A wrapper around v8::ScriptCompiler::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);

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:

Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::UnboundScript> script)
Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::BoundScript> script)

Nan::ScriptOrigin

A class transparently extending v8::ScriptOrigin to provide backwards compatibility. Only the listed methods are guaranteed to be available on all versions of Node.

Declaration:

class Nan::ScriptOrigin : public v8::ScriptOrigin {
 public:
  ScriptOrigin(v8::Local<v8::Value> name, v8::Local<v8::Integer> line = v8::Local<v8::Integer>(), v8::Local<v8::Integer> column = v8::Local<v8::Integer>())
  v8::Local<v8::Value> ResourceName() const;
  v8::Local<v8::Integer> ResourceLineOffset() const;
  v8::Local<v8::Integer> ResourceColumnOffset() const;
}