Skip to content

Commit adb60d4

Browse files
committed
fix: Remove alarm sound
1 parent 6014ced commit adb60d4

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/components/program_window/program_tab.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::sync::Arc;
33
use itertools::Itertools;
44
use leptos::{
55
component, create_node_ref, create_rw_signal, ev, event_target_value, html, spawn_local,
6-
use_context, view, IntoView, NodeRef, RwSignal, Signal, SignalGetUntracked, SignalSet,
7-
SignalUpdate, SignalWith, SignalWithUntracked,
6+
use_context, view, IntoView, RwSignal, Signal, SignalGetUntracked, SignalSet, SignalUpdate,
7+
SignalWith, SignalWithUntracked,
88
};
99
use simfony::parse::ParseFromStr;
1010
use simfony::simplicity::jet::elements::ElementsEnv;
@@ -102,8 +102,6 @@ pub struct Runtime {
102102
pub run_succeeded: RwSignal<Option<bool>>,
103103
pub debug_output: RwSignal<String>,
104104
pub error_output: RwSignal<String>,
105-
// This node ref needs to be mounted somewhere in order to work.
106-
pub alarm_audio_ref: NodeRef<html::Audio>,
107105
}
108106

109107
impl Runtime {
@@ -114,14 +112,10 @@ impl Runtime {
114112
run_succeeded: Default::default(),
115113
debug_output: Default::default(),
116114
error_output: Default::default(),
117-
alarm_audio_ref: Default::default(),
118115
}
119116
}
120117

121118
fn set_success(self, success: bool) {
122-
if !success {
123-
self.alarm_audio_ref.get().map(|audio| audio.play());
124-
}
125119
spawn_local(async move {
126120
self.run_succeeded.set(Some(success));
127121
gloo_timers::future::TimeoutFuture::new(500).await;

src/components/program_window/run_button.rs

-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::components::state::update_local_storage;
77
pub fn RunButton() -> impl IntoView {
88
let program = use_context::<Program>().expect("program should exist in context");
99
let runtime = use_context::<Runtime>().expect("runtime should exist in context");
10-
let audio_ref = runtime.alarm_audio_ref;
1110

1211
let run_program = move |_event: ev::MouseEvent| {
1312
program.add_default_modules();
@@ -28,11 +27,5 @@ pub fn RunButton() -> impl IntoView {
2827
<i class="fas fa-play"></i>
2928
" Run"
3029
</button>
31-
<audio
32-
preload="auto"
33-
node_ref=audio_ref
34-
>
35-
<source src="images/alarm.ogg" type="audio/ogg" />
36-
</audio>
3730
}
3831
}

0 commit comments

Comments
 (0)