This commit is contained in:
kozabrada123 2024-01-19 15:31:40 +01:00
parent 1baa14f857
commit 796bea7492
2 changed files with 10 additions and 4 deletions

View File

@ -11,7 +11,7 @@ use tokio::{self};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use safina_timer::sleep_for; use safina_timer::sleep_for;
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
use wasmtimer::tokio::sleep_for; use wasmtimer::tokio::sleep;
// This example creates a simple gateway connection and a basic observer struct // This example creates a simple gateway connection and a basic observer struct
@ -65,6 +65,9 @@ async fn main() {
// Do something on the main thread so we don't quit // Do something on the main thread so we don't quit
loop { loop {
sleep_for(Duration::MAX).await #[cfg(not(target_arch = "wasm32"))]
sleep_for(Duration::MAX).await;
#[cfg(target_arch = "wasm32")]
sleep(Duration::MAX).await;
} }
} }

View File

@ -6,7 +6,7 @@ use chorus::{self, types::GatewayIdentifyPayload};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use safina_timer::sleep_for; use safina_timer::sleep_for;
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
use wasmtimer::tokio::sleep_for; use wasmtimer::tokio::sleep;
/// This example creates a simple gateway connection and a session with an Identify event /// This example creates a simple gateway connection and a session with an Identify event
#[tokio::main(flavor = "current_thread")] #[tokio::main(flavor = "current_thread")]
@ -38,6 +38,9 @@ async fn main() {
// Do something on the main thread so we don't quit // Do something on the main thread so we don't quit
loop { loop {
sleep_for(Duration::MAX).await #[cfg(not(target_arch = "wasm32"))]
sleep_for(Duration::MAX).await;
#[cfg(target_arch = "wasm32")]
sleep(Duration::MAX).await;
} }
} }