JS_PropertyStub 编辑

Default implementations of the required callbacks in JSClass.

Syntax

bool
JS_PropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
                JS::MutableHandleValue vp);

bool
JS_StrictPropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
                      JS::MutableHandleValue vp, JS::ObjectOpResult &result); // Added in SpiderMonkey 45

bool
JS_StrictPropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
                      bool strict, JS::MutableHandleValue vp); // Obsolete since JSAPI 39

bool
JS_ResolveStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
               bool *resolvedp); // Obsolete since JSAPI 37

bool
JS_DeletePropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
                      bool *succeeded); // Obsolete since JSAPI 37

bool
JS_EnumerateStub(JSContext *cx, JS::HandleObject obj); // Obsolete since JSAPI 37

bool
JS_ConvertStub(JSContext *cx, JS::HandleObject obj, JSType type,
               JS::MutableHandleValue vp); // Obsolete since JSAPI 37

void
JS_FinalizeStub(JSContext *cx, JSObject *obj); // Obsolete since JSAPI 14

Description

The stub functions are not designed to be called directly by a JSAPI application. Rather, they are convenient stand-ins anywhere the JSAPI requires callbacks of certain types. Examples at JSClass illustrate how stub functions can be used.

JS_PropertyStub is of type JSPropertyOp, the type of getter callback. It can be used in JSClass.addProperty, and JSClass.getProperty. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true.

JS_StrictPropertyStub is of type JSStrictPropertyOp, the type of setter callback. It can be used in JSClass.setProperty. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true.

JS_DeletePropertyStub is of type JSDeletePropertyOp, the type of setter callback. It can be used in JSClass.delProperty. It behaves exactly like a property callback that accepts the default property behavior: it does nothing and returns true.

JS_EnumerateStub is a stub for JSClass.enumerate. It does nothing and returns true.

JS_ResolveStub is a stub for JSClass.resolve. It does nothing and returns true.

JS_ConvertStub is a stub for JSClass.convert. Its behavior is the same as the default conversion behavior for Objects. It attempts to call the object's valueOf and toString functions, in the order determined by the specified type, in accordance with the default DefaultValue algorithm in ES5 §8.12.8.

JS_FinalizeStub is a stub for JSClass.finalize. It does nothing.

See Also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:71 次

字数:7993

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文