JS_FS

Macros for describing functions, for use with JS_DefineProperties and JS_InitClass.

Syntax

#define JS_FS(name, call, nargs, flags, extra)   ... /* a JSFunctionSpec initializer */

#define JS_FN(name, fastcall, nargs, flags)      ... /* a JSFunctionSpec initializer */

#define JS_FS_END Obsolete since JavaScript 1.8.5... /* defines the end of the JSFunctionSpec array */
Name Type Description
name constĀ charĀ * The JavaScript name for the function. (or index, if JSPROP_INDEX is present in flags?)
call JSNative (in JS_FS only) Pointer to the C/C++ implementation of the function.
fastcall JSFastNative (in JS_FN only) Pointer to the C/C++ implementation of the function.
nargs uint16 The number of arguments the function expects.
flags uint16 The logical OR of zero or more function flags and property attributes.
extra uint32 (in JS_FS only) The number of extra slots the JSNative requires.

Description

Use these macros to define an array of JSFunctionSpecs to pass to JS_DefineFunctions or JS_InitClass.

Each call to JS_FS produces an initializer for a function implemented as a JSNative. Each call to JS_FN produces an initializer for a function implemented as a JSFastNative. These two may both be used in the same array. The last element of the array must be JS_FS_END.

See an example in the JSAPI User Guide.

MXR ID Search for JS_FS
MXR ID Search for JS_FN
MXR ID Search for JS_FS_END

Document Tags and Contributors

Contributors to this page: Jorend
Last updated by: Jorend,