本文整理汇总了C++中JSHandleObject类的典型用法代码示例。如果您正苦于以下问题:C++ JSHandleObject类的具体用法?C++ JSHandleObject怎么用?C++ JSHandleObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSHandleObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPropertyWrapper
JSBool JavaObject::setPropertyWrapper(JSContext* ctx, JSHandleObject obj,
JSHandleId id, JSBool strict, jsval *vp) {
#if GECKO_VERSION >= 16000
return setProperty(ctx, obj.get(), id.get(), strict, vp);
#else
return setProperty(ctx, obj.value(), id.value(), strict, vp);
#endif
}
示例2:
bool
JSStructuredCloneWriter::writeArrayBuffer(JSHandleObject obj)
{
ArrayBufferObject &buffer = obj->asArrayBuffer();
return out.writePair(SCTAG_ARRAY_BUFFER_OBJECT, buffer.byteLength()) &&
out.writeBytes(buffer.dataPointer(), buffer.byteLength());
}
示例3: getPropertyWrapper
JSBool JavaObject::getPropertyWrapper(JSContext* ctx, JSHandleObject obj,
JSHandleId id, JSMutableHandleValue vp) {
jsval rval;
JSBool result = JavaObject::getProperty(ctx, obj.get(), id.get(), &rval);
vp.set(rval);
return result;
}
示例4: def_timestep_image_map_set_width
CEXPORT JSBool def_timestep_image_map_set_width(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_image_map *thiz = (timestep_image_map*)JS_GetPrivate(obj.get());
if (thiz) {
thiz->width = vp.toInt32();
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例5: def_timestep_image_map_get_marginLeft
CEXPORT JSBool def_timestep_image_map_get_marginLeft(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_image_map *thiz = (timestep_image_map*)JS_GetPrivate(obj.get());
if (thiz) {
vp.setInt32(thiz->margin_left);
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例6: def_timestep_view_get_offsetX
CEXPORT JSBool def_timestep_view_get_offsetX(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
if (thiz) {
vp.setNumber(thiz->offset_x);
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例7: def_timestep_view_set_y
CEXPORT JSBool def_timestep_view_set_y(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
if (thiz) {
thiz->y = vp.toNumber();
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例8: def_timestep_view_get_filterType
CEXPORT JSBool def_timestep_view_get_filterType(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
if (thiz) {
vp.setInt32(thiz->filter_type);
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例9: def_timestep_image_map_get_url
CEXPORT JSBool def_timestep_image_map_get_url(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_image_map *thiz = (timestep_image_map*)JS_GetPrivate(obj.get());
if (thiz) {
vp.setString(JS_NewStringCopyZ(cx, thiz->url));
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例10: def_timestep_view_get___firstRender
CEXPORT JSBool def_timestep_view_get___firstRender(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
if (thiz) {
vp.setBoolean(thiz->__first_render);
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例11: js_cocos2dx_extension_WebSocket_get_readyState
static JSBool js_cocos2dx_extension_WebSocket_get_readyState(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
{
JSObject* jsobj = obj.get();
js_proxy_t *proxy = jsb_get_js_proxy(jsobj);
WebSocket* cobj = (WebSocket *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (cobj) {
vp.set(INT_TO_JSVAL((int)cobj->getReadyState()));
return JS_TRUE;
} else {
JS_ReportError(cx, "Error: WebSocket instance is invalid.");
return JS_FALSE;
}
}
示例12: def_timestep_view_get_filterColor
CEXPORT JSBool def_timestep_view_get_filterColor(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
if (thiz) {
rgba prop = thiz->filter_color;
char buf[64];
int len = rgba_to_string(&prop, buf);
vp.setString(JS_NewStringCopyN(cx, buf, len));
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例13: def_timestep_view_set_filterColor
CEXPORT JSBool def_timestep_view_set_filterColor(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
if (thiz) {
if (vp.isString()) {
JSString *jstr = vp.toString();
JSTR_TO_CSTR(cx, jstr, cstr);
rgba color;
rgba_parse(&color, cstr);
thiz->filter_color = color;
}
}
JS_EndRequest(cx);
return JS_TRUE;
}
示例14: document_resolve
JSBool
document_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, JSObject **objp)
{
// If id is "all", and we're not detecting, resolve document.all=true.
jsvalRoot v(cx);
if (!JS_IdToValue(cx, id, v.addr()))
return false;
if (JSVAL_IS_STRING(v.value())) {
JSString *str = JSVAL_TO_STRING(v.value());
JSFlatString *flatStr = JS_FlattenString(cx, str);
if (!flatStr)
return false;
if (JS_FlatStringEqualsAscii(flatStr, "all") && !(flags & JSRESOLVE_DETECTING)) {
JSBool ok = JS_DefinePropertyById(cx, obj, id, JSVAL_TRUE, NULL, NULL, 0);
*objp = ok ? obj.value() : NULL;
return ok;
}
}
*objp = NULL;
return true;
}
示例15: def_timestep_image_map_set_url
CEXPORT JSBool def_timestep_image_map_set_url(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp) {
JS_BeginRequest(cx);
timestep_image_map *thiz = (timestep_image_map*)JS_GetPrivate(obj.get());
if (thiz) {
if (vp.isString()) {
JSString *jstr = vp.toString();
JSTR_TO_CSTR_PERSIST(cx, jstr, cstr);
if (thiz->url) {
free(thiz->url);
}
thiz->url = cstr;
}
}
JS_EndRequest(cx);
return JS_TRUE;
}