chore(napi): expose tokio runtime
This commit is contained in:
parent
c01bcecb2b
commit
5bd6c78b5a
1 changed files with 4 additions and 0 deletions
|
@ -9,6 +9,10 @@ use crate::{check_status, sys, JsDeferred, JsUnknown, NapiValue, Result};
|
|||
pub(crate) static RT: Lazy<Runtime> =
|
||||
Lazy::new(|| tokio::runtime::Runtime::new().expect("Create tokio runtime failed"));
|
||||
|
||||
pub fn runtime() -> &'static Runtime {
|
||||
&RT
|
||||
}
|
||||
|
||||
/// Spawns a future onto the Tokio runtime.
|
||||
///
|
||||
/// Depending on where you use it, you should await or abort the future in your drop function.
|
||||
|
|
Loading…
Reference in a new issue