mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 22:21:38 +02:00
🐛 Fix broken test build for rust wasm
This commit is contained in:
parent
304c44048f
commit
9e9612cf1f
2 changed files with 25 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
use crate::get_now;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
pub fn get_time() -> i32 {
|
pub fn get_time() -> i32 {
|
||||||
|
|
|
@ -1,25 +1,35 @@
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! request_animation_frame {
|
macro_rules! request_animation_frame {
|
||||||
() => {
|
() => {{
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
{
|
unsafe extern "C" {
|
||||||
extern "C" {
|
pub fn wapi_requestAnimationFrame() -> i32;
|
||||||
pub fn wapi_requestAnimationFrame() -> i32;
|
|
||||||
}
|
|
||||||
unsafe { wapi_requestAnimationFrame() }
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
let result = unsafe { wapi_requestAnimationFrame() };
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
let result = 0;
|
||||||
|
|
||||||
|
result
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! cancel_animation_frame {
|
macro_rules! cancel_animation_frame {
|
||||||
($frame_id:expr) => {
|
($frame_id:expr) => {
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
unsafe extern "C" {
|
||||||
|
pub fn wapi_cancelAnimationFrame(frame_id: i32);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
extern "C" {
|
#[cfg(target_arch = "wasm32")]
|
||||||
pub fn wapi_cancelAnimationFrame(frame_id: i32);
|
unsafe {
|
||||||
}
|
wapi_cancelAnimationFrame($frame_id)
|
||||||
unsafe { wapi_cancelAnimationFrame($frame_id) }
|
};
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
let _ = $frame_id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue