2021-07-02 12:45:51 +00:00
|
|
|
use flowy_sys::prelude::*;
|
2021-06-29 08:52:29 +00:00
|
|
|
use std::{cell::RefCell, sync::Once};
|
2021-06-27 07:11:41 +00:00
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
pub fn setup_env() {
|
|
|
|
static INIT: Once = Once::new();
|
|
|
|
INIT.call_once(|| {
|
2021-06-28 14:56:15 +00:00
|
|
|
std::env::set_var("RUST_LOG", "flowy_sys=debug,debug");
|
2021-06-27 07:11:41 +00:00
|
|
|
env_logger::init();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-07-02 12:45:51 +00:00
|
|
|
pub async fn async_send(data: DispatchRequest<i64>) -> Result<EventResponse, SystemError> {
|
|
|
|
EventDispatch::async_send(data).await
|
2021-06-28 14:56:15 +00:00
|
|
|
}
|
|
|
|
|
2021-07-02 12:45:51 +00:00
|
|
|
pub fn init_system<F>(module_factory: F)
|
2021-06-28 14:56:15 +00:00
|
|
|
where
|
2021-07-02 12:45:51 +00:00
|
|
|
F: FnOnce() -> Vec<Module>,
|
2021-06-28 14:56:15 +00:00
|
|
|
{
|
2021-07-02 12:45:51 +00:00
|
|
|
let system = EventDispatch::new(module_factory);
|
|
|
|
EventDispatch::set_current(system);
|
2021-06-28 14:56:15 +00:00
|
|
|
}
|