v8  3.11.10 (node 0.8.28)
V8 is Google's open source JavaScript engine
Script Class Reference

#include <v8.h>

Public Member Functions

Local< ValueRun ()
 
Local< ValueId ()
 
void SetData (Handle< String > data)
 

Static Public Member Functions

static Local< ScriptNew (Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *pre_data=NULL, Handle< String > script_data=Handle< String >())
 
static Local< ScriptNew (Handle< String > source, Handle< Value > file_name)
 
static Local< ScriptCompile (Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *pre_data=NULL, Handle< String > script_data=Handle< String >())
 
static Local< ScriptCompile (Handle< String > source, Handle< Value > file_name, Handle< String > script_data=Handle< String >())
 

Detailed Description

A compiled JavaScript script.

Definition at line 592 of file v8.h.

Member Function Documentation

◆ Compile() [1/2]

static Local<Script> Compile ( Handle< String source,
Handle< Value file_name,
Handle< String script_data = HandleString >() 
)
static

Compiles the specified script using the specified file name object (typically a string) as the script's origin.

Parameters
sourceScript source code.
file_nameFile name to use as script's origin
script_dataArbitrary data associated with script. Using this has same effect as calling SetData(), but makes data available earlier (i.e. to compile event handlers).
Returns
Compiled script object, bound to the context that was active when this function was called. When run it will always use this context.

◆ Compile() [2/2]

static Local<Script> Compile ( Handle< String source,
ScriptOrigin origin = NULL,
ScriptData pre_data = NULL,
Handle< String script_data = HandleString >() 
)
static

Compiles the specified script (bound to current context).

Parameters
sourceScript source code.
originScript origin, owned by caller, no references are kept when Compile() returns
pre_dataPre-parsing data, as obtained by ScriptData::PreCompile() using pre_data speeds compilation if it's done multiple times. Owned by caller, no references are kept when Compile() returns.
script_dataArbitrary data associated with script. Using this has same effect as calling SetData(), but makes data available earlier (i.e. to compile event handlers).
Returns
Compiled script object, bound to the context that was active when this function was called. When run it will always use this context.

◆ Id()

Local<Value> Id ( )

Returns the script id value.

◆ New() [1/2]

static Local<Script> New ( Handle< String source,
Handle< Value file_name 
)
static

Compiles the specified script using the specified file name object (typically a string) as the script's origin.

Parameters
sourceScript source code.
file_namefile name object (typically a string) to be used as the script's origin.
Returns
Compiled script object (context independent; when run it will use the currently entered context).

◆ New() [2/2]

static Local<Script> New ( Handle< String source,
ScriptOrigin origin = NULL,
ScriptData pre_data = NULL,
Handle< String script_data = HandleString >() 
)
static

Compiles the specified script (context-independent).

Parameters
sourceScript source code.
originScript origin, owned by caller, no references are kept when New() returns
pre_dataPre-parsing data, as obtained by ScriptData::PreCompile() using pre_data speeds compilation if it's done multiple times. Owned by caller, no references are kept when New() returns.
script_dataArbitrary data associated with script. Using this has same effect as calling SetData(), but allows data to be available to compile event handlers.
Returns
Compiled script object (context independent; when run it will use the currently entered context).

◆ Run()

Local<Value> Run ( )

Runs the script returning the resulting value. If the script is context independent (created using ::New) it will be run in the currently entered context. If it is context specific (created using ::Compile) it will be run in the context in which it was compiled.

◆ SetData()

void SetData ( Handle< String data)

Associate an additional data object with the script. This is mainly used with the debugger as this data object is only available through the debugger API.


The documentation for this class was generated from the following file: