mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat:IInline math equation (#2949)
This commit is contained in:
@ -14,6 +14,10 @@ lazy_static! {
|
||||
static ref NOTIFICATION_SENDER: RwLock<Vec<Box<dyn NotificationSender>>> = RwLock::new(vec![]);
|
||||
}
|
||||
|
||||
/// Register a notification sender. The sender will be alive until the process exits.
|
||||
/// Flutter integration test or Tauri hot reload might cause register multiple times.
|
||||
/// So before register a new sender, you might need to unregister the old one. Currently,
|
||||
/// Just remove all senders by calling `unregister_all_notification_sender`.
|
||||
pub fn register_notification_sender<T: NotificationSender>(sender: T) {
|
||||
let box_sender = Box::new(sender);
|
||||
match NOTIFICATION_SENDER.write() {
|
||||
@ -22,6 +26,13 @@ pub fn register_notification_sender<T: NotificationSender>(sender: T) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unregister_all_notification_sender() {
|
||||
match NOTIFICATION_SENDER.write() {
|
||||
Ok(mut write_guard) => write_guard.clear(),
|
||||
Err(err) => tracing::error!("Failed to remove all notification senders: {:?}", err),
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NotificationSender: Send + Sync + 'static {
|
||||
fn send_subject(&self, subject: SubscribeObject) -> Result<(), String>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user