Driver: Add ability to clear all global event handlers.
Closes #32. This should make event handler cleanup considerably easier depending on use case.
This commit is contained in:
@@ -238,6 +238,12 @@ impl Driver {
|
||||
self.send(CoreMessage::AddEvent(EventData::new(event, action)));
|
||||
}
|
||||
|
||||
/// Removes all global event handlers from an audio context.
|
||||
#[instrument(skip(self))]
|
||||
pub fn remove_all_global_events(&mut self) {
|
||||
self.send(CoreMessage::RemoveGlobalEvents);
|
||||
}
|
||||
|
||||
/// Sends a message to the inner tasks, restarting it if necessary.
|
||||
fn send(&mut self, status: CoreMessage) {
|
||||
// Restart thread if it errored.
|
||||
|
||||
Reference in New Issue
Block a user