Showing the changes to libraries/script-engine/src/WebSocketServerClass.cpp (1 of 170 files). Show all
Unified · Split
| @@ -26,21 +26,21 @@ WebSocketServerClass::WebSocketServerClass(ScriptEngine* engine, const QString& · 25 unmodified lines | |||
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | ScriptValuePointer WebSocketServerClass::constructor(ScriptContext* context, ScriptEngine* engine) { | 29 | ScriptValue WebSocketServerClass::constructor(ScriptContext* context, ScriptEngine* engine) { |
| 30 | // the serverName is used in handshakes | 30 | // the serverName is used in handshakes |
| 31 | QString serverName = QStringLiteral("HighFidelity - Scripted WebSocket Listener"); | 31 | QString serverName = QStringLiteral("HighFidelity - Scripted WebSocket Listener"); |
| 32 | // port 0 will auto-assign a free port | 32 | // port 0 will auto-assign a free port |
| 33 | quint16 port = 0; | 33 | quint16 port = 0; |
| 34 | ScriptValuePointer callee = context->callee(); | 34 | ScriptValue callee = context->callee(); |
| 35 | if (context->argumentCount() > 0) { | 35 | if (context->argumentCount() > 0) { |
| 36 | ScriptValuePointer options = context->argument(0); | 36 | ScriptValue options = context->argument(0); |
| 37 | ScriptValuePointer portOption = options->property(QStringLiteral("port")); | 37 | ScriptValue portOption = options.property(QStringLiteral("port")); |
| 38 | if (portOption->isValid() && portOption->isNumber()) { | 38 | if (portOption.isValid() && portOption.isNumber()) { |
| 39 | port = portOption->toNumber(); | 39 | port = portOption.toNumber(); |
| 40 | } | 40 | } |
| 41 | ScriptValuePointer serverNameOption = options->property(QStringLiteral("serverName")); | 41 | ScriptValue serverNameOption = options.property(QStringLiteral("serverName")); |
| 42 | if (serverNameOption->isValid() && serverNameOption->isString()) { | 42 | if (serverNameOption.isValid() && serverNameOption.isString()) { |
| 43 | serverName = serverNameOption->toString(); | 43 | serverName = serverNameOption.toString(); |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | return engine->newQObject(new WebSocketServerClass(engine, serverName, port), ScriptEngine::ScriptOwnership); | 46 | return engine->newQObject(new WebSocketServerClass(engine, serverName, port), ScriptEngine::ScriptOwnership); |