remove load_and_get_signal
, rename timeline
to load_signal_and_get_timeline
This commit is contained in:
parent
d8c1b0abac
commit
3f61f9f3fe
7 changed files with 15 additions and 65 deletions
|
@ -81,17 +81,8 @@ pub(super) async fn get_time_table() -> wellen::TimeTable {
|
|||
serde_json::from_value(serde_json::to_value(time_table).unwrap_throw()).unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen::Signal {
|
||||
let mut waveform_lock = STORE.waveform.lock().unwrap_throw();
|
||||
let waveform = waveform_lock.as_mut().unwrap_throw();
|
||||
// @TODO maybe run it in a thread to not block the main one and then
|
||||
waveform.load_signals(&[signal_ref]);
|
||||
let signal = waveform.get_signal(signal_ref).unwrap_throw();
|
||||
// @TODO `clone` / `Rc/Arc` / refactor?
|
||||
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, block_height: u32) -> shared::Timeline {
|
||||
pub(super) async fn load_signal_and_get_timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
||||
// @TODO implement, copy from tauri platform
|
||||
shared::Timeline { blocks: Vec::new() }
|
||||
}
|
||||
|
||||
|
|
|
@ -21,18 +21,9 @@ pub(super) async fn get_time_table() -> wellen::TimeTable {
|
|||
serde_wasm_bindgen::from_value(tauri_glue::get_time_table().await.unwrap_throw()).unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen::Signal {
|
||||
pub(super) async fn load_signal_and_get_timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
||||
serde_wasm_bindgen::from_value(
|
||||
tauri_glue::load_and_get_signal(signal_ref.index())
|
||||
.await
|
||||
.unwrap_throw(),
|
||||
)
|
||||
.unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
||||
serde_wasm_bindgen::from_value(
|
||||
tauri_glue::timeline(signal_ref.index(), screen_width, block_height)
|
||||
tauri_glue::load_signal_and_get_timeline(signal_ref.index(), screen_width, block_height)
|
||||
.await
|
||||
.unwrap_throw(),
|
||||
)
|
||||
|
@ -64,10 +55,7 @@ mod tauri_glue {
|
|||
pub async fn get_time_table() -> Result<JsValue, JsValue>;
|
||||
|
||||
#[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, block_height: u32) -> Result<JsValue, JsValue>;
|
||||
pub async fn load_signal_and_get_timeline(signal_ref_index: usize, screen_width: u32, block_height: u32) -> Result<JsValue, JsValue>;
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
|
||||
|
|
Reference in a new issue