Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

script.md 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ## Script
  2. NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8.
  3. - <a href="#api_nan_compile_script"><b><code>Nan::CompileScript()</code></b></a>
  4. - <a href="#api_nan_run_script"><b><code>Nan::RunScript()</code></b></a>
  5. <a name="api_nan_compile_script"></a>
  6. ### Nan::CompileScript()
  7. A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.11/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b).
  8. Note that `Nan::BoundScript` is an alias for `v8::Script`.
  9. Signature:
  10. ```c++
  11. Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(
  12. v8::Local<v8::String> s,
  13. const v8::ScriptOrigin& origin);
  14. Nan::MaybeLocal<Nan::BoundScript> Nan::CompileScript(v8::Local<v8::String> s);
  15. ```
  16. <a name="api_nan_run_script"></a>
  17. ### Nan::RunScript()
  18. Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`.
  19. 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.
  20. Signature:
  21. ```c++
  22. Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::UnboundScript> script)
  23. Nan::MaybeLocal<v8::Value> Nan::RunScript(v8::Local<Nan::BoundScript> script)
  24. ```