Clean up
This commit is contained in:
parent
46ca1b7353
commit
b74015f03e
4 changed files with 1 additions and 17 deletions
2
main.js
2
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({});
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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)
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue