Skip to content

Commit

Permalink
lll
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMcInnes committed Dec 18, 2024
1 parent fea38a4 commit 2f11af1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/backendconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ void BackendConnection::openUrl(const QString &url)
emscripten_run_script(ba.constData());
}

// Sometimes, the wasm code may crash. Use a watchdog to detect this and reload the page when necessary.
void BackendConnection::hitWatchdog()
{
emscripten_run_script("watchdogHit = true"); // 'watchdogHit' is defined in venus-gui-v2.html, which checks it periodically and reloads the page if not hit regularly.
}

#else

void BackendConnection::onNetworkConfigChanged(const QVariant var) { Q_UNUSED(var); }
Expand Down Expand Up @@ -688,11 +694,5 @@ void BackendConnectionTester::qmlEngineAvailable(QQmlEngine *engine)
engine->rootContext()->setContextProperty("dbusBackend", &dbusBackend);
}

// Sometimes, the wasm code may crash. Use a watchdog to detect this and reload the page when necessary.
void BackendConnection::hitWatchdog()
{
emscripten_run_script("watchdogHit = true"); // 'watchdogHit' is defined in venus-gui-v2.html, which checks it periodically and reloads the page if not hit regularly.
}

}
}
2 changes: 2 additions & 0 deletions src/backendconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ class BackendConnection : public QObject
// Move this to some mock data manager when available
Q_INVOKABLE void setMockValue(const QString &uid, const QVariant &value);
Q_INVOKABLE QVariant mockValue(const QString &uid) const;
#if defined(VENUS_WEBASSEMBLY_BUILD)
Q_INVOKABLE void hitWatchdog();
#endif

Q_SIGNALS:
void stateChanged();
Expand Down

0 comments on commit 2f11af1

Please sign in to comment.