Merge pull request #503 from fanatid/patch-1
Remove deprecated `register_module` from example in README.md
This commit is contained in:
commit
3dd071540b
1 changed files with 4 additions and 8 deletions
|
@ -4,19 +4,15 @@
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate napi;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate napi_derive;
|
extern crate napi_derive;
|
||||||
|
|
||||||
use napi::{CallContext, Error, JsNumber, JsUnknown, Module, Result, Status};
|
use napi::{CallContext, Error, JsNumber, JsUnknown, Module, Result, Status};
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
register_module!(napi_derive_example, init);
|
#[module_exports]
|
||||||
|
fn init(mut exports: JsObject) -> Result<()> {
|
||||||
fn init(module: &mut Module) -> Result<()> {
|
exports.create_named_method("testThrow", test_throw)?;
|
||||||
module.create_named_method("testThrow", test_throw)?;
|
exports.create_named_method("fibonacci", fibonacci)?;
|
||||||
|
|
||||||
module.create_named_method("fibonacci", fibonacci)?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue