This article needs a technical review. How you can help.
This article covers features introduced in SpiderMonkey 17
Macros for describing properties, for use with JS_DefineProperties
and JS_InitClass
.
Syntax
#define JS_PSG(name, getter, flags) ... #define JS_PSGS(name, getter, setter, flags) ... #define JS_SELF_HOSTED_GET(name, getterName, flags) ... // Added in SpiderMonkey 31 #define JS_SELF_HOSTED_GETSET(name, getterName, setterName, flags) ... // Added in SpiderMonkey 31 #define JS_PS_END ...
Name | Type | Description |
---|---|---|
name |
const char * |
The JavaScript name for the property. (or index, if JSPROP_INDEX is present in flags) |
getter |
JSNative |
Pointer to the C/C++ implementation of the getter function. |
setter |
JSNative |
Pointer to the C/C++ implementation of the setter function. |
flags |
uint16 |
The bitwise OR of any number of property attributes. |
getterName |
const char * |
The function's name in Self-Hosted JavaScript code for getter function. |
setterName |
const char * |
The function's name in Self-Hosted JavaScript code for setter function. |
Description
These macros encapsulate the definition of JSNative
-backed JSPropertySpec
s, by defining the JSNativeWrappers
for them.
See Also
- MXR ID Search for
JS_PSG
- MXR ID Search for
JS_PSGS
- MXR ID Search for
JS_SELF_HOSTED_GET
- MXR ID Search for
JS_SELF_HOSTED_GETSET
JSPropertySpec
JS_DefineProperties
JS_InitClass
- bug 684526 - added.
- bug 938728 - added
JS_SELF_HOSTED_GET
andJS_SELF_HOSTED_GETSET
.