|
Mac Dev Center
Mac OS X Reference Library Networking, Internet, & Web JavaScriptCore Framework Reference
|
JSBase.h |
| Includes: | <stdbool.h> |
Use the links in the table of contents to the left to access the documentation.
Checks for syntax errors in a string of JavaScript.
Evaluates a string of JavaScript.
Performs a JavaScript garbage collection.
JSCheckScriptSyntax |
Checks for syntax errors in a string of JavaScript.
JS_EXPORT bool JSCheckScriptSyntax( JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef *exception);
ctxThe execution context to use.
scriptA JSString containing the script to check for syntax errors.
sourceURLA JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
startingLineNumberAn integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
exceptionA pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.
true if the script is syntactically correct, otherwise false.
JSEvaluateScript |
Evaluates a string of JavaScript.
JS_EXPORT JSValueRef JSEvaluateScript( JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef *exception);
ctxThe execution context to use.
scriptA JSString containing the script to evaluate.
thisObjectThe object to use as "this," or NULL to use the global object as "this."
sourceURLA JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
startingLineNumberAn integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
exceptionA pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
The JSValue that results from evaluating script, or NULL if an exception is thrown.
JSGarbageCollect |
Performs a JavaScript garbage collection.
JS_EXPORT void JSGarbageCollect( JSContextRef ctx);
ctxThe execution context to use.
JavaScript values that are on the machine stack, in a register, protected by JSValueProtect, set as the global object of an execution context, or reachable from any such value will not be collected.
During JavaScript execution, you are not required to call this function; the JavaScript engine will garbage collect as needed. JavaScript values created within a context group are automatically destroyed when the last reference to the context group is released.
JSClassRef |
typedef struct OpaqueJSClass* JSClassRef;
A JavaScript class. Used with JSObjectMake to construct objects with custom behavior.
JSContextGroupRef |
typedef const struct OpaqueJSContextGroup* JSContextGroupRef;
A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects.
JSContextRef |
typedef const struct OpaqueJSContext* JSContextRef;
A JavaScript execution context. Holds the global object and other execution state.
JSGlobalContextRef |
typedef struct OpaqueJSContext* JSGlobalContextRef;
A global JavaScript execution context. A JSGlobalContext is a JSContext.
JSObjectRef |
typedef struct OpaqueJSValue* JSObjectRef;
A JavaScript object. A JSObject is a JSValue.
JSPropertyNameAccumulatorRef |
typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef;
An ordered set used to collect the names of a JavaScript object's properties.
JSPropertyNameArrayRef |
typedef struct OpaqueJSPropertyNameArray* JSPropertyNameArrayRef;
An array of JavaScript property names.
JSStringRef |
typedef struct OpaqueJSString* JSStringRef;
A UTF16 character buffer. The fundamental string representation in JavaScript.
JSValueRef |
typedef const struct OpaqueJSValue* JSValueRef;
A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them.
Last Updated: 2009-08-12