2467b7139b
* napi procedural macro for basic rust/JavaScript types * introduce the `compat-mode` for `napi` and `napi-derive` crates for backward compatible * remove #[inline] and let compiler to decide the inline behavior * cli now can produce the `.d.ts` file for native binding * many tests and example for the new procedural macro Co-authored-by: LongYinan <lynweklm@gmail.com>
19 lines
588 B
Rust
19 lines
588 B
Rust
use napi::{JsObject, Result};
|
|
|
|
mod async_cleanup;
|
|
mod object;
|
|
|
|
use async_cleanup::*;
|
|
use object::*;
|
|
|
|
pub fn register_js(exports: &mut JsObject) -> Result<()> {
|
|
exports.create_named_method("testSealObject", seal_object)?;
|
|
exports.create_named_method("testFreezeObject", freeze_object)?;
|
|
exports.create_named_method(
|
|
"testAddRemovableAsyncCleanupHook",
|
|
add_removable_async_cleanup_hook,
|
|
)?;
|
|
exports.create_named_method("testRemoveAsyncCleanupHook", remove_async_cleanup_hook)?;
|
|
exports.create_named_method("testAddAsyncCleanupHook", add_async_cleanup_hook)?;
|
|
Ok(())
|
|
}
|