diff --git a/examples/sit.js b/examples/sit.js index 072471aa30..b5664b0d10 100644 --- a/examples/sit.js +++ b/examples/sit.js @@ -269,8 +269,7 @@ function update(deltaTime){ } var locationChanged = false; - if (location.hostname != oldHost) { - print("Changed domain"); + if (location.hostname != oldHost || !location.isConnected) { for (model in models) { removeIndicators(models[model]); } diff --git a/interface/src/scripting/LocationScriptingInterface.cpp b/interface/src/scripting/LocationScriptingInterface.cpp index 44ff94aa1f..9e68778942 100644 --- a/interface/src/scripting/LocationScriptingInterface.cpp +++ b/interface/src/scripting/LocationScriptingInterface.cpp @@ -20,6 +20,10 @@ LocationScriptingInterface* LocationScriptingInterface::getInstance() { return &sharedInstance; } +bool LocationScriptingInterface::isConnected() { + return NodeList::getInstance()->getDomainHandler().isConnected(); +} + QString LocationScriptingInterface::getHref() { return getProtocol() + "//" + getHostname() + getPathname(); } diff --git a/interface/src/scripting/LocationScriptingInterface.h b/interface/src/scripting/LocationScriptingInterface.h index 36b6d97561..20f63bceed 100644 --- a/interface/src/scripting/LocationScriptingInterface.h +++ b/interface/src/scripting/LocationScriptingInterface.h @@ -22,6 +22,7 @@ class LocationScriptingInterface : public QObject { Q_OBJECT + Q_PROPERTY(bool isConnected READ isConnected) Q_PROPERTY(QString href READ getHref) Q_PROPERTY(QString protocol READ getProtocol) Q_PROPERTY(QString hostname READ getHostname) @@ -30,6 +31,7 @@ class LocationScriptingInterface : public QObject { public: static LocationScriptingInterface* getInstance(); + bool isConnected(); QString getHref(); QString getProtocol() { return CUSTOM_URL_SCHEME; }; QString getPathname();