platform::timeline

This commit is contained in:
Martin Kavík 2024-06-06 22:04:57 +02:00
parent c0de520811
commit 6e85b7fa35
16 changed files with 157 additions and 217 deletions

View file

@ -91,6 +91,10 @@ pub(super) async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen
serde_json::from_value(serde_json::to_value(signal).unwrap_throw()).unwrap_throw()
}
pub(super) async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32) -> shared::Timeline {
shared::Timeline { blocks: Vec::new() }
}
pub(super) async fn unload_signal(signal_ref: wellen::SignalRef) {
let mut waveform_lock = STORE.waveform.lock().unwrap_throw();
let waveform = waveform_lock.as_mut().unwrap_throw();

View file

@ -30,6 +30,15 @@ pub(super) async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen
.unwrap_throw()
}
pub(super) async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32) -> shared::Timeline {
serde_wasm_bindgen::from_value(
tauri_glue::timeline(signal_ref.index(), screen_width)
.await
.unwrap_throw(),
)
.unwrap_throw()
}
pub(super) async fn unload_signal(signal_ref: wellen::SignalRef) {
tauri_glue::unload_signal(signal_ref.index())
.await
@ -57,6 +66,9 @@ mod tauri_glue {
#[wasm_bindgen(catch)]
pub async fn load_and_get_signal(signal_ref_index: usize) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch)]
pub async fn timeline(signal_ref_index: usize, screen_width: u32) -> Result<JsValue, JsValue>;
#[wasm_bindgen(catch)]
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
}