• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ JS_SetProperty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中JS_SetProperty函数的典型用法代码示例。如果您正苦于以下问题:C++ JS_SetProperty函数的具体用法?C++ JS_SetProperty怎么用?C++ JS_SetProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了JS_SetProperty函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: register_all_fygui

void register_all_fygui(JSContext* cx, JSObject* obj) {
	// first, try to get the ns
	jsval nsval;
	JSObject *ns;
	JS_GetProperty(cx, obj, "fygui", &nsval);
	if (nsval == JSVAL_VOID) {
		ns = JS_NewObject(cx, NULL, NULL, NULL);
		nsval = OBJECT_TO_JSVAL(ns);
		JS_SetProperty(cx, obj, "fygui", &nsval);
	} else {
		JS_ValueToObject(cx, nsval, &ns);
	}
	obj = ns;

	js_register_fygui_FYPropCell(cx, obj);
}
开发者ID:zhengtg,项目名称:JustFind,代码行数:16,代码来源:jsb_fygui_auto.cpp


示例2: jsg_resolve_prop

static JSBool
jsg_resolve_prop(JSContext *cx, JSObject *obj, jsval id)
{
  js_setting_group_t *jsg = JS_GetPrivate(cx, obj);
  const char *name;
  name = JSVAL_IS_STRING(id) ? JS_GetStringBytes(JSVAL_TO_STRING(id)) : NULL;
  if(name != NULL) {
    htsmsg_field_t *f;

    if((f = htsmsg_field_find(jsg->jsg_store, name)) != NULL) {
      jsval vp = jsval_from_htsmsgfield(cx, f);
      JS_SetProperty(cx, obj, name, &vp);
    }
  }
  return JS_TRUE;
}
开发者ID:dreamcat4,项目名称:showtime,代码行数:16,代码来源:js_settings.c


示例3: register_all_PluginIAPJS

void register_all_PluginIAPJS(JSContext* cx, JSObject* obj) {
    // first, try to get the ns
    jsval nsval;
    JSObject *ns;
    JS_GetProperty(cx, obj, "sdkbox", &nsval);
    if (nsval == JSVAL_VOID) {
        ns = JS_NewObject(cx, NULL, NULL, NULL);
        nsval = OBJECT_TO_JSVAL(ns);
        JS_SetProperty(cx, obj, "sdkbox", &nsval);
    } else {
        JS_ValueToObject(cx, nsval, &ns);
    }
    obj = ns;

    js_register_PluginIAPJS_IAP(cx, obj);
}
开发者ID:fordream,项目名称:sdkbox-soomlagrow-sample,代码行数:16,代码来源:PluginIAPJS.cpp


示例4: smjs_init_globhist_interface

void
smjs_init_globhist_interface(void)
{
    jsval val;
    struct JSObject *globhist;

    if (!smjs_ctx || !smjs_elinks_object)
        return;

    globhist = smjs_get_globhist_object();
    if (!globhist) return;

    val = OBJECT_TO_JSVAL(globhist);

    JS_SetProperty(smjs_ctx, smjs_elinks_object, "globhist", &val);
}
开发者ID:methril,项目名称:elinks,代码行数:16,代码来源:globhist.c


示例5: register_CocosPlayer

void register_CocosPlayer(JSContext* cx, JSObject* obj) {
	// first, try to get the ns
	jsval nsval;
	JSObject *ns;
	JS_GetProperty(cx, obj, "cc", &nsval);
	if (nsval == JSVAL_VOID) {
		ns = JS_NewObject(cx, NULL, NULL, NULL);
		nsval = OBJECT_TO_JSVAL(ns);
		JS_SetProperty(cx, obj, "cc", &nsval);
	} else {
		JS_ValueToObject(cx, nsval, &ns);
	}
	obj = ns;
    
    JS_DefineFunction(cx, obj, "_cocosplayerLog", JS_cocosPlayerLog, 2, JSPROP_READONLY | JSPROP_PERMANENT);
}
开发者ID:Ratel13,项目名称:cocos2d-frame,代码行数:16,代码来源:StreamMessagingHelper.cpp


示例6: XMLGraph_Init

JSBool
XMLGraph_Init(JSContext *cx, JSObject *obj, JSObject *parent_proto)
{
    jsval v = JSVAL_NULL;
    JSObject *proto = JS_InitClass(cx, obj, parent_proto, &XMLGraph_class,
				   XMLGraph, 1,
				   xmlgraph_props, xmlgraph_funcs,
				   NULL, NULL);

    if (!proto)
	return JS_FALSE;
    if (!JS_SetProperty(cx, proto, "nameBy", &v)) {
	JS_ReportError(cx, "failed to set XMLGraph.prototype.nameBy = null");
	return JS_FALSE;
    }
    return JS_TRUE;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:17,代码来源:jsxgraph.c


示例7: register_all_cocos2dx_spine

void register_all_cocos2dx_spine(JSContext* cx, JSObject* obj) {
	// first, try to get the ns
	JS::RootedValue nsval(cx);
	JSObject *ns;
	JS_GetProperty(cx, obj, "sp", &nsval);
	if (nsval == JSVAL_VOID) {
		ns = JS_NewObject(cx, NULL, NULL, NULL);
		nsval = OBJECT_TO_JSVAL(ns);
		JS_SetProperty(cx, obj, "sp", nsval);
	} else {
		JS_ValueToObject(cx, nsval, &ns);
	}
	obj = ns;

	js_register_cocos2dx_spine_Skeleton(cx, obj);
	js_register_cocos2dx_spine_SkeletonAnimation(cx, obj);
}
开发者ID:6520874,项目名称:pipiGame,代码行数:17,代码来源:jsb_cocos2dx_spine_auto.cpp


示例8: register_facebook_js

void register_facebook_js(JSContext* cx, JSObject* global){
	jsval nsval;
	JSObject *facebookJsbObject;

	JS_GetProperty(cx, global, "FacebookJsb", &nsval);
	if (nsval == JSVAL_VOID) {
		facebookJsbObject = JS_NewObject(cx, NULL, NULL, NULL);
		nsval = OBJECT_TO_JSVAL(facebookJsbObject);
		JS_SetProperty(cx, global, "FacebookJsb", &nsval);
	} else 
		JS_ValueToObject(cx, nsval, &facebookJsbObject);

	JS_DefineFunction(cx, facebookJsbObject, "login", JSB_Facebook_login, 2, JSPROP_READONLY | JSPROP_PERMANENT);
	JS_DefineFunction(cx, facebookJsbObject, "logout", JSB_Facebook_logout, 1, JSPROP_READONLY | JSPROP_PERMANENT);
	JS_DefineFunction(cx, facebookJsbObject, "getLoginStatus", JSB_Facebook_getLoginStatus, 2, JSPROP_READONLY | JSPROP_PERMANENT);
	JS_DefineFunction(cx, facebookJsbObject, "api", JSB_Facebook_api, 4, JSPROP_READONLY | JSPROP_PERMANENT);
	JS_DefineFunction(cx, facebookJsbObject, "ui", JSB_Facebook_ui, 2, JSPROP_READONLY | JSPROP_PERMANENT);
}
开发者ID:Ratel13,项目名称:facebook-jsb-sdk-samples,代码行数:18,代码来源:js_bindings_facebook.cpp


示例9: FillMyHashMap

static bool
FillMyHashMap(JSContext* cx, MutableHandle<MyHashMap> map)
{
    for (size_t i = 0; i < 10; ++i) {
        RootedObject obj(cx, JS_NewObject(cx, nullptr));
        RootedValue val(cx, UndefinedValue());
        // Construct a unique property name to ensure that the object creates a
        // new shape.
        char buffer[2];
        buffer[0] = 'a' + i;
        buffer[1] = '\0';
        if (!JS_SetProperty(cx, obj, buffer, val))
            return false;
        if (!map.putNew(obj->as<NativeObject>().lastProperty(), obj))
            return false;
    }
    return true;
}
开发者ID:rthyberg,项目名称:gecko-dev,代码行数:18,代码来源:testGCExactRooting.cpp


示例10: onClose

    virtual void onClose(WebSocket* ws)
    {
        js_proxy_t * p = jsb_get_native_proxy(ws);
        if (!p) return;
        
        JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
        JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL);
        jsval vp = c_string_to_jsval(cx, "close");
        JS_SetProperty(cx, jsobj, "type", &vp);
        
        jsval args = OBJECT_TO_JSVAL(jsobj);
        ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "onclose", 1, &args);

        js_proxy_t* jsproxy = jsb_get_js_proxy(p->obj);
        JS_RemoveObjectRoot(cx, &jsproxy->obj);
        jsb_remove_proxy(p, jsproxy);
        CC_SAFE_DELETE(ws);
    }
开发者ID:Ben-Cortina,项目名称:GameBox,代码行数:18,代码来源:jsb_websocket.cpp


示例11: register_all_PluginIAPJS

void register_all_PluginIAPJS(JSContext* cx, JSObject* obj) {
    // first, try to get the ns
    JS::RootedValue nsval(cx);
    JS::RootedObject ns(cx);
    JS_GetProperty(cx, obj, "sdkbox", &nsval);
    if (nsval == JSVAL_VOID) {
        ns = JS_NewObject(cx, NULL, NULL, NULL);
        nsval = OBJECT_TO_JSVAL(ns);
        JS_SetProperty(cx, obj, "sdkbox", nsval);
    } else {
        JS_ValueToObject(cx, nsval, &ns);
    }
    obj = ns;

    js_register_PluginIAPJS_IAP(cx, obj);

    sdkbox::setProjectType("js");
}
开发者ID:tinybearc,项目名称:sdkbox-sample-iap,代码行数:18,代码来源:PluginIAPJS.cpp


示例12: js_CreateInternalJsObject

JSObject* DLLCALL js_CreateInternalJsObject(JSContext* cx, JSObject* parent, js_callback_t* cb, js_startup_t* startup)
{
	JSObject*	obj;

	if((obj = JS_DefineObject(cx, parent, "js", &js_internal_class, NULL
		,JSPROP_ENUMERATE|JSPROP_READONLY))==NULL)
		return(NULL);

	if(!JS_SetPrivate(cx, obj, cb))	/* Store a pointer to js_callback_t */
		return(NULL);

	if(startup!=NULL) {
		JSObject*	load_path_list;
		jsval		val;
		str_list_t	load_path;

		if((load_path_list=JS_NewArrayObject(cx, 0, NULL))==NULL) 
			return(NULL);
		val=OBJECT_TO_JSVAL(load_path_list);
		if(!JS_SetProperty(cx, obj, JAVASCRIPT_LOAD_PATH_LIST, &val)) 
			return(NULL);

		if((load_path=strListSplitCopy(NULL, startup->load_path, ",")) != NULL) {
			JSString*	js_str;
			unsigned	i;

			for(i=0; load_path[i]!=NULL; i++) {
				if((js_str=JS_NewStringCopyZ(cx, load_path[i]))==NULL)
					break;
				val=STRING_TO_JSVAL(js_str);
				if(!JS_SetElement(cx, load_path_list, i, &val))
					break;
			}
			strListFree(&load_path);
		}
	}

#ifdef BUILD_JSDOCS
	js_DescribeSyncObject(cx,obj,"JavaScript engine internal control object",311);
	js_CreateArrayOfStrings(cx, obj, "_property_desc_list", prop_desc, JSPROP_READONLY);
#endif

	return(obj);
}
开发者ID:mattzorzin,项目名称:synchronet,代码行数:44,代码来源:js_internal.c


示例13: register_pluginx_js_extensions

void register_pluginx_js_extensions(JSContext* cx, JSObject* global)
{
    // first, try to get the ns
    JS::RootedValue nsval(cx);
    JS::RootedObject ns(cx);
    JS_GetProperty(cx, global, "plugin", &nsval);
    if (nsval == JSVAL_VOID) {
        ns = JS_NewObject(cx, NULL, NULL, NULL);
        nsval = OBJECT_TO_JSVAL(ns);
        JS_SetProperty(cx, global, "plugin", nsval);
    } else {
        JS_ValueToObject(cx, nsval, &ns);
    }

    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolIAP_prototype, "setListener", js_pluginx_ProtocolIAP_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolIAP_prototype, "getListener", js_pluginx_ProtocolIAP_getResultListener, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolIAP_prototype, "payForProduct", js_pluginx_ProtocolIAP_payForProduct, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolAds_prototype, "setListener", js_pluginx_ProtocolAds_setAdsListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolAds_prototype, "getListener", js_pluginx_ProtocolAds_getAdsListener, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolShare_prototype, "setListener", js_pluginx_ProtocolShare_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolShare_prototype, "getListener", js_pluginx_ProtocolShare_getResultListener, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolShare_prototype, "share", js_pluginx_ProtocolShare_share, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolSocial_prototype, "setListener", js_pluginx_ProtocolSocial_setListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolSocial_prototype, "getListener", js_pluginx_ProtocolSocial_getListener, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolSocial_prototype, "submitScore", js_pluginx_ProtocolSocial_submitScore, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolSocial_prototype, "unlockAchievement", js_pluginx_ProtocolSocial_unlockAchievement, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolUser_prototype, "setActionListener", js_pluginx_ProtocolUser_setActionListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolUser_prototype, "getActionListener", js_pluginx_ProtocolUser_getActionListener, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolUser_prototype, "login", js_pluginx_ProtocolUser_login, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolUser_prototype, "logout", js_pluginx_ProtocolUser_logout, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callFuncWithParam", js_pluginx_PluginProtocol_callFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callStringFuncWithParam", js_pluginx_PluginProtocol_callStringFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callIntFuncWithParam", js_pluginx_PluginProtocol_callIntFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callFloatFuncWithParam", js_pluginx_PluginProtocol_callFloatFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callBoolFuncWithParam", js_pluginx_PluginProtocol_callBoolFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    
    JS_DefineFunction(cx, jsb_cocos2d_plugin_FacebookAgent_prototype, "login", js_pluginx_FacebookAgent_login, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_FacebookAgent_prototype, "_api", js_pluginx_FacebookAgent_api, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_FacebookAgent_prototype, "appRequest", js_pluginx_FacebookAgent_appRequest, 0, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_FacebookAgent_prototype, "dialog", js_pluginx_FacebookAgent_dialog, 0, JSPROP_READONLY | JSPROP_PERMANENT);

    global = ns;
    js_register_pluginx_protocols_PluginParam(cx, global);
}
开发者ID:TheWindShan,项目名称:HYFish,代码行数:44,代码来源:jsb_pluginx_extension_registration.cpp


示例14: try_to_chain_stack_trace

static void
try_to_chain_stack_trace(JSContext *src_context, JSContext *dst_context,
                         jsval src_exc) {
    /* append current stack of dst_context to stack trace for src_exc.
     * we bail if anything goes wrong, just using the src_exc unmodified
     * in that case. */
    jsval chained, src_stack, dst_stack, new_stack;
    JSString *new_stack_str;

    JS_BeginRequest(src_context);
    JS_BeginRequest(dst_context);

    if (!JSVAL_IS_OBJECT(src_exc))
        goto out; // src_exc doesn't have a stack trace

    /* create a new exception in dst_context to get a stack trace */
    gjs_throw_literal(dst_context, "Chained exception");
    if (!(JS_GetPendingException(dst_context, &chained) &&
          JSVAL_IS_OBJECT(chained)))
        goto out; // gjs_throw_literal didn't work?!
    JS_ClearPendingException(dst_context);

    /* get stack trace for src_exc and chained */
    if (!(gjs_object_get_property(dst_context, JSVAL_TO_OBJECT(chained),
                                  "stack", &dst_stack) &&
          JSVAL_IS_STRING(dst_stack)))
        goto out; // couldn't get chained stack
    if (!(gjs_object_get_property(src_context, JSVAL_TO_OBJECT(src_exc),
                                  "stack", &src_stack) &&
          JSVAL_IS_STRING(src_stack)))
        goto out; // couldn't get source stack

    /* add chained exception's stack trace to src_exc */
    new_stack_str = JS_ConcatStrings
        (dst_context, JSVAL_TO_STRING(src_stack), JSVAL_TO_STRING(dst_stack));
    if (new_stack_str==NULL)
        goto out; // couldn't concatenate src and dst stacks?!
    new_stack = STRING_TO_JSVAL(new_stack_str);
    JS_SetProperty(dst_context, JSVAL_TO_OBJECT(src_exc), "stack", &new_stack);

 out:
    JS_EndRequest(dst_context);
    JS_EndRequest(src_context);
}
开发者ID:sjokkis,项目名称:gjs,代码行数:44,代码来源:jsapi-util.c


示例15: register_LoadUrlImage_js

void register_LoadUrlImage_js(JSContext* cx, JSObject* global)
{
    JS::RootedValue nsval(cx);
    JS::RootedValue tmpval(cx);
    JS::RootedObject pJsbObject(cx);

    JS_GetProperty(cx, global, "LoadUrlImage", &nsval);
    if (nsval == JSVAL_VOID) {
        pJsbObject = JS_NewObject(cx, NULL, NULL, NULL);
        nsval = OBJECT_TO_JSVAL(global);
        JS_SetProperty(cx, global, "LoadUrlImage", nsval);
    }
    else
    {
        JS_ValueToObject(cx, nsval, &pJsbObject);
    }

    JS_DefineFunction(cx, global, "loadUrlImage", JSB_LoadUrlImage_loadUrlImage, 2, JSPROP_READONLY | JSPROP_PERMANENT);
}
开发者ID:Ryeeeeee,项目名称:cocos2d-JS-3.0Alpha-FacebookDemo,代码行数:19,代码来源:js_bindings_loadUrlImage.cpp


示例16: Output_flush

JSBool
Output_flush (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
    JS_BeginRequest(cx);
    JS_EnterLocalRootScope(cx);

    jsval property;
    JS_GetProperty(cx, obj, "content", &property);

    FCGX_PutS(JS_GetStringBytes(JS_ValueToString(cx, property)), ((LCGIData*) JS_GetContextPrivate(cx))->cgi->out);

    property = JS_GetEmptyStringValue(cx);
    JS_SetProperty(cx, obj, "content", &property);

    JS_LeaveLocalRootScope(cx);
    JS_EndRequest(cx);

    return JS_TRUE;
}
开发者ID:mandrake,项目名称:lulzjs,代码行数:19,代码来源:Output.cpp


示例17: register_pluginx_js_extensions

void register_pluginx_js_extensions(JSContext* cx, JSObject* obj)
{
	// first, try to get the ns
	JS::RootedValue nsval(cx);
	JS::RootedObject ns(cx);
	JS_GetProperty(cx, obj, "plugin", &nsval);
	if (nsval == JSVAL_VOID) {
		ns = JS_NewObject(cx, NULL, NULL, NULL);
		nsval = OBJECT_TO_JSVAL(ns);
		JS_SetProperty(cx, obj, "plugin", nsval);
	} else {
		JS_ValueToObject(cx, nsval, &ns);
	}
	obj = ns;

/*
    // first, try to get the ns
    JS::RootedValue nsval(cx);
    JSObject *ns;
    JS_GetProperty(cx, obj, "plugin", &nsval);
    if (nsval == JSVAL_VOID) {
        ns = JS_NewObject(cx, NULL, NULL, NULL);
        nsval = OBJECT_TO_JSVAL(ns);
        JS_SetProperty(cx, obj, "plugin", nsval);
    } else {
        JS_ValueToObject(cx, nsval, &ns);
    }
*/

    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolIAP_prototype, "setResultListener", js_pluginx_ProtocolIAP_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolAds_prototype, "setAdsListener", js_pluginx_ProtocolAds_setAdsListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolShare_prototype, "setResultListener", js_pluginx_ProtocolShare_setResultListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolSocial_prototype, "setListener", js_pluginx_ProtocolSocial_setListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_ProtocolUser_prototype, "setActionListener", js_pluginx_ProtocolUser_setActionListener, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callFuncWithParam", js_pluginx_PluginProtocol_callFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callStringFuncWithParam", js_pluginx_PluginProtocol_callStringFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callIntFuncWithParam", js_pluginx_PluginProtocol_callIntFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callFloatFuncWithParam", js_pluginx_PluginProtocol_callFloatFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_cocos2d_plugin_PluginProtocol_prototype, "callBoolFuncWithParam", js_pluginx_PluginProtocol_callBoolFuncWithParam, 1, JSPROP_READONLY | JSPROP_PERMANENT);

    obj = ns;
    js_register_pluginx_protocols_PluginParam(cx, obj);
}
开发者ID:NatWeiss,项目名称:bindings-pluginx,代码行数:43,代码来源:jsb_pluginx_extension_registration.cpp


示例18: JS_NewRuntime

ScriptingCore::ScriptingCore() {
	/* Create the JSRuntime. */
	this->mJSRuntime = JS_NewRuntime(8L * 1024L * 1024L);
	if (this->mJSRuntime == NULL) {
		LOG_D("Could not create JSRuntime!");
	}

	/* Create the JSContext. */
	this->mJSContext = JS_NewContext(this->mJSRuntime, 8192);
	if (this->mJSContext == NULL) {
		LOG_D("Could not create JSContext!");
	}

	/* Set flags. */
	JS_SetOptions(this->mJSContext, JSOPTION_VAROBJFIX);
	JS_SetVersion(this->mJSContext, JSVERSION_LATEST);
	JS_SetErrorReporter(this->mJSContext, reportError);

	/* Create the global object in a new compartment. */
	this->mGlobal = JS_NewCompartmentAndGlobalObject(this->mJSContext, &global_class, NULL);
	if (this->mGlobal == NULL) {
		LOG_D("Could not create global!");
	}

	if (!JS_InitStandardClasses(this->mJSContext, this->mGlobal)) {
		LOG_D("Could not initialize standard classes!");
	}

	/* Create the AndEngine namespace. */
	JSObject* andengineNamespace = JS_NewObject(this->mJSContext, NULL, NULL, NULL);
	jsval andengineNamespaceVal = OBJECT_TO_JSVAL(andengineNamespace);
	JS_SetProperty(this->mJSContext, this->mGlobal, "andengine", &andengineNamespaceVal);

	/* Register AndEngine classes. */
	S_Entity::jsCreateClass(this->mJSContext, andengineNamespace, "Entity");
//	S_CCSize::jsCreateClass(this->mJSContext, andengineNamespace, "Size");
//	S_CCRect::jsCreateClass(this->mJSContext, andengineNamespace, "Rect");

	/* Register some global functions. */
//	JS_DefineFunction(this->mJSContext, andengineNamespace, "log", ScriptingCore::log, 0, JSPROP_READONLY | JSPROP_PERMANENT);
//	JS_DefineFunction(this->mJSContext, andengineNamespace, "forceGC", ScriptingCore::forceGC, 0, JSPROP_READONLY | JSPROP_PERMANENT);
}
开发者ID:ReactionYkt,项目名称:AndroidGames,代码行数:42,代码来源:ScriptingCore.cpp


示例19: register_CCBuilderReader

void register_CCBuilderReader(JSContext *cx, JSObject *obj) {
    jsval nsval;
	JSObject *ns;
	JS_GetProperty(cx, obj, "cc", &nsval);
	if (nsval == JSVAL_VOID) {
		ns = JS_NewObject(cx, NULL, NULL, NULL);
		nsval = OBJECT_TO_JSVAL(ns);
		JS_SetProperty(cx, obj, "cc", &nsval);
	} else {
		JS_ValueToObject(cx, nsval, &ns);
	}
	obj = ns;

    JSObject  *tmpObj = JSVAL_TO_OBJECT(anonEvaluate(cx, obj, "(function () { return cc._Reader; })()"));
    JS_DefineFunction(cx, tmpObj, "create", js_CocosBuilder_create, 2, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, tmpObj, "loadScene", js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT);
    
    JS_DefineFunction(cx, jsb_CCBReader_prototype, "load", js_cocos2dx_CCBReader_readNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT);
    JS_DefineFunction(cx, jsb_CCBAnimationManager_prototype, "setCompletedAnimationCallback", js_cocos2dx_CCBAnimationManager_animationCompleteCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT);
}
开发者ID:CodeSnooker,项目名称:cocos2d-x,代码行数:20,代码来源:js_bindings_ccbreader.cpp


示例20: getNetworkId

CharacterNetwork::~CharacterNetwork()
{
    const char* id = getNetworkId();
    printf("~CharacterNetwork %s\n", id);
    
#if defined(COCOS2D_JAVASCRIPT) && ISCLIENT == 1
    if (!_native)
    {
        jsval jsCharacterNetwork = CharacterNetwork::getNetworkObjectById(id);
        jsval networkObjects = CharacterNetwork::getNetworkObjects();
        if (jsCharacterNetwork != JSVAL_VOID)
        {
            //printf("set null\n");
            jsCharacterNetwork.setNull();
            JS_SetProperty(_cx(), &networkObjects.toObject(), id, &jsCharacterNetwork);
        }  
    }
#endif
    
}
开发者ID:code-acmer,项目名称:p02,代码行数:20,代码来源:Character.cpp



注:本文中的JS_SetProperty函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ JS_ValueToInt32函数代码示例发布时间:2022-05-30
下一篇:
C++ JS_SET_TRACING_NAME函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap