Example #1
0
static bool _js_get_SIOClient_tag(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
{
    CCLOG("JSB SocketIO.getTag method called");
    JSObject* jsobj = obj.get();
    js_proxy_t *proxy = jsb_get_js_proxy(jsobj);
    SIOClient* cobj = (SIOClient *)(proxy ? proxy->ptr : NULL);
    JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
    
    if (cobj) {
        vp.set(std_string_to_jsval(cx, cobj->getTag()));
        return true;
    } else {
        JS_ReportError(cx, "Error: SocketIO instance is invalid.");
        return false;
    }

}
static bool _js_get_SIOClient_tag(JSContext* cx, uint32_t argc, jsval* vp)
{
    CCLOG("JSB SocketIO.getTag method called");
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    JSObject* jsobj = args.thisv().toObjectOrNull();
    js_proxy_t *proxy = jsb_get_js_proxy(jsobj);
    SIOClient* cobj = (SIOClient *)(proxy ? proxy->ptr : NULL);
    JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
    
    if (cobj)
    {
        args.rval().set(std_string_to_jsval(cx, cobj->getTag()));
        return true;
    } else
    {
        JS_ReportError(cx, "Error: SocketIO instance is invalid.");
        return false;
    }
}