JS ExecuteScriptPart
From MDC
Executes a part of a compiled script.
[edit] Syntax
typedef enum JSExecPart { JSEXEC_PROLOG, JSEXEC_MAIN } JSExecPart;
JSBool JS_ExecuteScriptPart(
JSContext *cx, JSObject *obj, JSScript *script,
JSExecPart part, jsval *rval);
| Name | Type | Description |
|---|---|---|
cx |
JSContext * |
The context in which to execute the script.
Requires request. (In a |
obj |
JSObject * |
The scope in which to execute the script. This parameter is documented in detail at JS_ExecuteScript. |
script |
JSScript * |
The compiled script to execute. |
part |
JSExecPart |
The part of script to execute. |
rval |
jsval * |
Out parameter. On success, *rval receives the value from the last executed expression statement in the script. |
[edit] Description
JS_ExecuteScriptPart executes part of a previously compiled script, script. The part parameter must be either JSEXEC_PROLOG to execute the script prolog or JSEXEC_MAIN to execute the main section of the script.
If the script executes successfully, JS_ExecuteScriptPart stores the value of the last-executed expression statement in the script in *rval and returns JS_TRUE. Otherwise it returns JS_FALSE, and the value left in *rval is undefined.
To execute both parts of a script, use JS_ExecuteScript instead.