From b74015f03ec0ef80c91380a21869ba7d97c9d425 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Mon, 19 Feb 2024 16:37:03 +1000 Subject: [PATCH] Clean up --- main.js | 2 +- src-tauri/src/main.rs | 13 ------------- src/{videopls.gleam => demo.gleam} | 1 - src/ffi/commands.js | 2 -- 4 files changed, 1 insertion(+), 17 deletions(-) rename src/{videopls.gleam => demo.gleam} (99%) diff --git a/main.js b/main.js index 79d066b..39d0895 100644 --- a/main.js +++ b/main.js @@ -22,7 +22,7 @@ import './style.css' // ` // setupCounter(document.querySelector('#counter')) -import { main } from './src/videopls.gleam' +import { main } from './src/demo.gleam' document.addEventListener("DOMContentLoaded", () => { const dispatch = main({}); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 6217932..bef010a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -30,16 +30,3 @@ fn main() { fn greet(name: &str) -> String { format!("Hello, {}!", name) } - -#[tauri::command] -fn clock(app: tauri::AppHandle) { - std::thread::spawn(move || { - loop { - let now = SystemTime::now(); - let duration = now.duration_since(UNIX_EPOCH).unwrap(); - app.emit_to(EventTarget::any(), "tick", duration.as_secs()) - .unwrap(); - std::thread::sleep(Duration::from_secs(1)); - } - }); -} diff --git a/src/videopls.gleam b/src/demo.gleam similarity index 99% rename from src/videopls.gleam rename to src/demo.gleam index e3503e1..ee844e6 100644 --- a/src/videopls.gleam +++ b/src/demo.gleam @@ -51,7 +51,6 @@ fn get_greeting(name: String) -> Effect(Msg) { fn do_get_greeting(name: String, dispatch: fn(Msg) -> Nil) -> Nil { greet(name) - // |> promise.await() |> promise.map(fn(response) { case response { Ok(greeting) -> GotGreeting(greeting) diff --git a/src/ffi/commands.js b/src/ffi/commands.js index 4f4b9d2..00353cf 100644 --- a/src/ffi/commands.js +++ b/src/ffi/commands.js @@ -11,9 +11,7 @@ export async function greet(name) { } export async function listenForTick(handler) { - console.log("listenForTick"); await listen('tick', (event) => { - console.log(event.payload); handler(event.payload); }); }