From 3abf70c34f5a354afd89b10017ffda05aad4e54f Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Tue, 20 Sep 2022 15:35:49 +0200 Subject: Periodically check if Northstar is running --- src-ui/src/main.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src-ui') diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index df88af15..f7aa6ec6 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -131,6 +131,22 @@ document.addEventListener("DOMContentLoaded", async function () { console.log(evt.payload); }); + // listen northstar-running-ping event (from Tauri Rust App) + listen("northstar-running-ping", function (evt: TauriEvent) { + let northstar_is_running = evt.payload as boolean; + if (northstar_is_running) { + omniButtonEl.textContent = button_launched_string; + } + else { + // Only set button to launch Northstar if was running before + // Otherwise we'd have to check on each access if Titanfall2 path set, Northstar is installed, etc. + if (omniButtonEl.textContent == button_launched_string) { + omniButtonEl.textContent = button_play_string; + } + } + console.log(evt.payload); + }); + // omni button click omniButtonEl.addEventListener("click", async function () { -- cgit v1.2.3