Public Member Functions | Static Public Member Functions

v8::Script Class Reference

#include <v8.h>

List of all members.

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.


Member Function Documentation

static Local<Script> v8::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:
source Script source code.
origin Script origin, owned by caller, no references are kept when Compile() returns
pre_data Pre-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_data Arbitrary 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.
static Local<Script> v8::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:
source Script source code.
file_name File name to use as script's origin
script_data Arbitrary 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.
Local<Value> v8::Script::Id (  ) 

Returns the script id value.

static Local<Script> v8::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:
source Script source code.
file_name file 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).
static Local<Script> v8::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:
source Script source code.
origin Script origin, owned by caller, no references are kept when New() returns
pre_data Pre-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_data Arbitrary 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).
Local<Value> v8::Script::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.

void v8::Script::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: