当前位置: 首页>>代码示例>>C++>>正文


C++ JSWebSocket类代码示例

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


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

示例1: jsWebSocketBufferedAmount

JSValue jsWebSocketBufferedAmount(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    return jsNumber(exec, imp->bufferedAmount());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:JSWebSocket.cpp

示例2: setJSWebSocketOnclose

void setJSWebSocketOnclose(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(thisObject);
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    imp->setOnclose(createJSAttributeEventListener(exec, value, thisObject));
}
开发者ID:13W,项目名称:phantomjs,代码行数:7,代码来源:JSWebSocket.cpp

示例3: jsWebSocketPrototypeFunctionRemoveEventListener

JSValue JSC_HOST_CALL jsWebSocketPrototypeFunctionRemoveEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSWebSocket::s_info))
        return throwError(exec, TypeError);
    JSWebSocket* castedThisObj = static_cast<JSWebSocket*>(asObject(thisValue));
    return castedThisObj->removeEventListener(exec, args);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:8,代码来源:JSWebSocket.cpp

示例4: jsWebSocketBufferedAmount

JSValue jsWebSocketBufferedAmount(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    JSValue result = jsNumber(imp->bufferedAmount());
    return result;
}
开发者ID:13W,项目名称:phantomjs,代码行数:8,代码来源:JSWebSocket.cpp

示例5: jsWebSocketURL

JSValue jsWebSocketURL(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    JSValue result = jsString(exec, imp->url());
    return result;
}
开发者ID:13W,项目名称:phantomjs,代码行数:8,代码来源:JSWebSocket.cpp

示例6: isReachableFromOpaqueRoots

bool JSWebSocketOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSWebSocket* jsWebSocket = static_cast<JSWebSocket*>(handle.get().asCell());
    if (jsWebSocket->impl()->hasPendingActivity())
        return true;
    if (!isObservable(jsWebSocket))
        return false;
    UNUSED_PARAM(visitor);
    return false;
}
开发者ID:13W,项目名称:phantomjs,代码行数:10,代码来源:JSWebSocket.cpp

示例7: jsWebSocketPrototypeFunctionClose

JSValue JSC_HOST_CALL jsWebSocketPrototypeFunctionClose(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSWebSocket::s_info))
        return throwError(exec, TypeError);
    JSWebSocket* castedThisObj = static_cast<JSWebSocket*>(asObject(thisValue));
    WebSocket* imp = static_cast<WebSocket*>(castedThisObj->impl());

    imp->close();
    return jsUndefined();
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:11,代码来源:JSWebSocket.cpp

示例8: jsWebSocketOnclose

JSValue jsWebSocketOnclose(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    if (EventListener* listener = imp->onclose()) {
        if (JSObject* jsFunction = listener->jsFunction(imp->scriptExecutionContext()))
            return jsFunction;
    }
    return jsNull();
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:11,代码来源:JSWebSocket.cpp

示例9: jsWebSocketPrototypeFunctionClose

EncodedJSValue JSC_HOST_CALL jsWebSocketPrototypeFunctionClose(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSWebSocket::s_info))
        return throwVMTypeError(exec);
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(thisValue));
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());

    imp->close();
    return JSValue::encode(jsUndefined());
}
开发者ID:13W,项目名称:phantomjs,代码行数:11,代码来源:JSWebSocket.cpp

示例10: jsWebSocketPrototypeFunctionRemoveEventListener

EncodedJSValue JSC_HOST_CALL jsWebSocketPrototypeFunctionRemoveEventListener(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSWebSocket::s_info))
        return throwVMTypeError(exec);
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(thisValue));
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    JSValue listener = exec->argument(1);
    if (!listener.isObject())
        return JSValue::encode(jsUndefined());
    imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
    return JSValue::encode(jsUndefined());
}
开发者ID:13W,项目名称:phantomjs,代码行数:13,代码来源:JSWebSocket.cpp

示例11: jsWebSocketOnclose

JSValue jsWebSocketOnclose(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    if (EventListener* listener = imp->onclose()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}
开发者ID:13W,项目名称:phantomjs,代码行数:13,代码来源:JSWebSocket.cpp

示例12: jsWebSocketPrototypeFunctionDispatchEvent

JSValue JSC_HOST_CALL jsWebSocketPrototypeFunctionDispatchEvent(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSWebSocket::s_info))
        return throwError(exec, TypeError);
    JSWebSocket* castedThisObj = static_cast<JSWebSocket*>(asObject(thisValue));
    WebSocket* imp = static_cast<WebSocket*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Event* evt = toEvent(args.at(0));


    JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
    setDOMException(exec, ec);
    return result;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:15,代码来源:JSWebSocket.cpp

示例13: jsWebSocketPrototypeFunctionDispatchEvent

EncodedJSValue JSC_HOST_CALL jsWebSocketPrototypeFunctionDispatchEvent(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSWebSocket::s_info))
        return throwVMTypeError(exec);
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(thisValue));
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    ExceptionCode ec = 0;
    Event* evt(toEvent(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
开发者ID:13W,项目名称:phantomjs,代码行数:17,代码来源:JSWebSocket.cpp

示例14: jsWebSocketPrototypeFunctionSend

EncodedJSValue JSC_HOST_CALL jsWebSocketPrototypeFunctionSend(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSWebSocket::s_info))
        return throwVMTypeError(exec);
    JSWebSocket* castedThis = static_cast<JSWebSocket*>(asObject(thisValue));
    WebSocket* imp = static_cast<WebSocket*>(castedThis->impl());
    if (exec->argumentCount() < 1)
        return JSValue::encode(jsUndefined());
    ExceptionCode ec = 0;
    const String& data(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = jsBoolean(imp->send(data, ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
开发者ID:13W,项目名称:phantomjs,代码行数:19,代码来源:JSWebSocket.cpp

示例15: finalize

void JSWebSocketOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSWebSocket* jsWebSocket = static_cast<JSWebSocket*>(handle.get().asCell());
    DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, jsWebSocket->impl(), jsWebSocket);
}
开发者ID:13W,项目名称:phantomjs,代码行数:6,代码来源:JSWebSocket.cpp


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