remove_all_decoders
This commit is contained in:
parent
deef698f8d
commit
b2055ff22d
8 changed files with 46 additions and 1 deletions
|
@ -16,6 +16,7 @@ use browser as platform;
|
|||
type Filename = String;
|
||||
type JavascriptCode = String;
|
||||
type AddedDecodersCount = usize;
|
||||
type RemovedDecodersCount = usize;
|
||||
type DecoderPath = String;
|
||||
|
||||
pub async fn show_window() {
|
||||
|
@ -64,3 +65,7 @@ pub async fn unload_signal(signal_ref: wellen::SignalRef) {
|
|||
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
||||
platform::add_decoders(decoder_paths).await
|
||||
}
|
||||
|
||||
pub async fn remove_all_decoders() -> RemovedDecodersCount {
|
||||
platform::remove_all_decoders().await
|
||||
}
|
||||
|
|
|
@ -128,3 +128,9 @@ pub(super) async fn add_decoders(
|
|||
eprintln!("Adding decoders is not supported in the browser.");
|
||||
0
|
||||
}
|
||||
|
||||
pub(super) async fn remove_all_decoders() -> super::RemovedDecodersCount {
|
||||
// @TODO error message for user
|
||||
eprintln!("Removing decoders is not supported in the browser.");
|
||||
0
|
||||
}
|
||||
|
|
|
@ -63,6 +63,11 @@ pub(super) async fn add_decoders(
|
|||
.unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn remove_all_decoders() -> super::RemovedDecodersCount {
|
||||
serde_wasm_bindgen::from_value(tauri_glue::remove_all_decoders().await.unwrap_throw())
|
||||
.unwrap_throw()
|
||||
}
|
||||
|
||||
mod tauri_glue {
|
||||
use zoon::*;
|
||||
|
||||
|
@ -98,5 +103,8 @@ mod tauri_glue {
|
|||
pub async fn add_decoders(
|
||||
decoder_paths: Vec<super::super::DecoderPath>,
|
||||
) -> Result<JsValue, JsValue>;
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn remove_all_decoders() -> Result<JsValue, JsValue>;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ use zoon::*;
|
|||
|
||||
type FullVarName = String;
|
||||
type AddedDecodersCount = usize;
|
||||
type RemovedDecodersCount = usize;
|
||||
type DecoderPath = String;
|
||||
|
||||
#[wasm_bindgen(module = "/typescript/bundles/strict_eval.js")]
|
||||
|
@ -72,4 +73,9 @@ impl FW {
|
|||
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
||||
platform::add_decoders(decoder_paths).await
|
||||
}
|
||||
|
||||
/// JS: `FW.remove_all_decoders()` -> `5`
|
||||
pub async fn remove_all_decoders() -> RemovedDecodersCount {
|
||||
platform::remove_all_decoders().await
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2539,12 +2539,16 @@ async function unload_signal(signal_ref_index) {
|
|||
async function add_decoders(decoder_paths) {
|
||||
return await invoke2("add_decoders", { decoder_paths });
|
||||
}
|
||||
async function remove_all_decoders() {
|
||||
return await invoke2("remove_all_decoders");
|
||||
}
|
||||
export {
|
||||
add_decoders,
|
||||
get_hierarchy,
|
||||
load_file_with_selected_vars,
|
||||
load_signal_and_get_timeline,
|
||||
pick_and_load_waveform,
|
||||
remove_all_decoders,
|
||||
show_window,
|
||||
unload_signal
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@ type WellenHierarchy = unknown;
|
|||
type Timeline = unknown;
|
||||
type VarFormat = unknown;
|
||||
type AddedDecodersCount = number;
|
||||
type RemovedDecodersCount = number;
|
||||
type DecoderPath = string;
|
||||
|
||||
export async function show_window(): Promise<void> {
|
||||
|
@ -53,3 +54,7 @@ export async function unload_signal(signal_ref_index: number): Promise<void> {
|
|||
export async function add_decoders(decoder_paths: Array<DecoderPath>): Promise<AddedDecodersCount> {
|
||||
return await invoke("add_decoders", { decoder_paths });
|
||||
}
|
||||
|
||||
export async function remove_all_decoders(): Promise<RemovedDecodersCount> {
|
||||
return await invoke("remove_all_decoders");
|
||||
}
|
||||
|
|
Reference in a new issue