jSObjectMakeFunction top-level property

Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> name, int parameterCount, Pointer<NativeType> parameterNames, Pointer<NativeType> body, Pointer<NativeType> sourceURL, int startingLineNumber, Pointer<Pointer<NativeType>> exception) jSObjectMakeFunction
final

Creates a function with a given script as its body. Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution. ctx (JSContextRef) The execution context to use. name (JSStringRef) A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. parameterCount (unsigned) An integer count of the number of parameter names in parameterNames. parameterNames (JSStringRef[]) A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0. body (JSStringRef) A JSString containing the script to use as the function's body. sourceURL (JSStringRef) A 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. startingLineNumber (int) An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1. exception (JSValueRef*) A 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. @result (JSObjectRef) 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.

Implementation

final Pointer Function(
        Pointer ctx,
        Pointer name,
        int parameterCount,
        Pointer parameterNames,
        Pointer body,
        Pointer sourceURL,
        int startingLineNumber,
        Pointer<Pointer> exception) jSObjectMakeFunction =
    JscFfi.lib
        .lookup<
            NativeFunction<
                Pointer Function(Pointer, Pointer, Int32, Pointer, Pointer,
                    Pointer, Int32, Pointer<Pointer>)>>('JSObjectMakeFunction')
        .asFunction();