Skip to content

Commit c1cae4b

Browse files
authored
Merge pull request #415 from orottier/fix/statechange-events
fix: implement clear_onstatechange and fix some event types
2 parents 2b5e221 + 60f845c commit c1cae4b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/context/base.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub trait BaseAudioContext {
309309
fn set_onstatechange<F: FnMut(Event) + Send + 'static>(&self, mut callback: F) {
310310
let callback = move |_| {
311311
callback(Event {
312-
type_: "onstatechange",
312+
type_: "statechange",
313313
})
314314
};
315315

@@ -319,6 +319,10 @@ pub trait BaseAudioContext {
319319
);
320320
}
321321

322+
fn clear_onstatechange(&self) {
323+
self.base().clear_event_handler(EventType::StateChange);
324+
}
325+
322326
#[cfg(test)]
323327
fn mock_registration(&self) -> AudioContextRegistration {
324328
AudioContextRegistration {

src/context/online.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl AudioContext {
329329
pub fn set_onsinkchange<F: FnMut(Event) + Send + 'static>(&self, mut callback: F) {
330330
let callback = move |_| {
331331
callback(Event {
332-
type_: "onsinkchange",
332+
type_: "sinkchange",
333333
})
334334
};
335335

0 commit comments

Comments
 (0)