Function javascriptcore_sys::JSObjectMakeFunction [] [src]

pub unsafe extern "C" fn JSObjectMakeFunction(
    ctx: JSContextRef,
    name: JSStringRef,
    parameterCount: c_uint,
    parameterNames: *const JSStringRef,
    body: JSStringRef,
    sourceURL: JSStringRef,
    startingLineNumber: c_int,
    exception: *mut JSValueRef
) -> JSObjectRef

Creates a function with a given script as its body.

Returns a JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype.

Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution.