leptos_animate 0.1.12

Animation utilities for Leptos. FLIP, in/out transitions, and helpers for custom animations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::time::Duration;

use futures::channel;
use leptos::prelude::set_timeout;

pub async fn sleep(duration: Duration) {
    let (tx, rx) = channel::oneshot::channel();

    set_timeout(
        move || {
            _ = tx.send(());
        },
        duration,
    );

    rx.await.unwrap();
}