Skip to content

Commit 826e466

Browse files
authored
Fixed example in addon.md. (#820)
PR-URL: #820 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
1 parent ceb27d4 commit 826e466

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/addon.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class ExampleAddon : public Napi::Addon<ExampleAddon> {
4141

4242
// We can also attach plain objects to `exports`, and instance methods as
4343
// properties of those sub-objects.
44-
InstanceValue("subObject", DefineProperties(Napi::Object::New(), {
45-
InstanceMethod("decrement", &ExampleAddon::Decrement
46-
})), napi_enumerable)
44+
InstanceValue("subObject", DefineProperties(Napi::Object::New(env), {
45+
InstanceMethod("decrement", &ExampleAddon::Decrement)
46+
}), napi_enumerable)
4747
});
4848
}
4949
private:
@@ -80,7 +80,7 @@ The above code can be used from JavaScript as follows:
8080
const exampleAddon = require('bindings')('example_addon');
8181
console.log(exampleAddon.increment()); // prints 43
8282
console.log(exampleAddon.increment()); // prints 44
83-
consnole.log(exampleAddon.subObject.decrement()); // prints 43
83+
console.log(exampleAddon.subObject.decrement()); // prints 43
8484
```
8585

8686
When Node.js loads an instance of the add-on, a new instance of the class is

0 commit comments

Comments
 (0)