JS_GetPropertyAttributes 编辑
Obsolete since JSAPI 26
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Get the attributes of a specified property.
Syntax
JSBool
JS_GetPropertyAttributes(JSContext *cx, JSObject *obj,
const char *name, unsigned int *attrsp, JSBool *foundp);
JSBool
JS_GetUCPropertyAttributes(JSContext *cx, JSObject *obj,
const jschar *name, size_t namelen,
unsigned int *attrsp, JSBool *foundp);
Name | Type | Description |
---|---|---|
cx | JSContext * | The context in which to look up property attributes. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext . |
obj | JSObject * | The object that has the property to be queried. |
name | const char * or const | Name of the property from which to retrieve attributes. |
namelen | size_t | (only in JS_GetUCPropertyAttributes ) The length of name in characters; or (size_t) -1 to indicate that name is null-terminated. |
attrsp | unsigned int * | Out parameter. If the specified property is found on obj , *attrsp receives its attributes. |
foundp | JSBool * | Out parameter. If no error occurs, *foundp receives JS_TRUE if the specified property is found and JS_FALSE if it is not found. If an error occurs, the value left in *foundp is unspecified. |
Description
JS_GetPropertyAttributes
retrieves the property attributes of the property with the given name
on a given object, obj
. JS_GetUCPropertyAttributes
is the Unicode version of the function.
If an error occurs, the return value is JS_FALSE
, and the values left in *attrsp
and *foundp
are unspecified.
If obj
does not have the specified property, or if it inherits it from some other object (on its prototype chain, for example), then *foundp
is set to JS_FALSE
. The value left in *attrsp
is unspecified. The return value is JS_TRUE
(to indicate that no error occurred).
If the property exists and belongs to obj
, then *foundp
is set to JS_TRUE
, *attrsp
is set to the logical OR of zero or more Property attributes flags, and the function returns JS_TRUE
.
See Also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论