This commit is contained in:
Wesley Moore 2024-02-19 16:37:03 +10:00
parent 46ca1b7353
commit b74015f03e
No known key found for this signature in database
4 changed files with 1 additions and 17 deletions

View File

@ -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({});

View File

@ -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));
}
});
}

View File

@ -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)

View File

@ -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);
});
}