napi-rs/examples/napi-compat-mode/src/napi8/mod.rs
forehalo 2467b7139b
Introduce #[napi] procedural macro to automation development boilerplate (#696)
* 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>
2021-09-23 01:29:09 +08:00

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(())
}