mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
Remove deprecated register_module from example in README.md
This commit is contained in:
parent
7c6bfb4087
commit
5527451b8d
@ -4,19 +4,15 @@
|
||||
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate napi;
|
||||
#[macro_use]
|
||||
extern crate napi_derive;
|
||||
|
||||
use napi::{CallContext, Error, JsNumber, JsUnknown, Module, Result, Status};
|
||||
use std::convert::TryInto;
|
||||
|
||||
register_module!(napi_derive_example, init);
|
||||
|
||||
fn init(module: &mut Module) -> Result<()> {
|
||||
module.create_named_method("testThrow", test_throw)?;
|
||||
|
||||
module.create_named_method("fibonacci", fibonacci)?;
|
||||
#[module_exports]
|
||||
fn init(mut exports: JsObject) -> Result<()> {
|
||||
exports.create_named_method("testThrow", test_throw)?;
|
||||
exports.create_named_method("fibonacci", fibonacci)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user