Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Feb 12, 2020
1 parent 433a1a1 commit 293ee15
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/addon_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
#define NAPI_EXPERIMENTAL
#include "napi.h"

// An overly elaborate way to get/set a boolean stored in the instance data:
// 0. A boolean named "verbose" is stored in the instance data. The constructor
// for JS `VerboseIndicator` instances is also stored in the instance data.
// 1. Add a property named "verbose" onto exports served by a getter/setter.
// 2. The getter returns a object of type VerboseIndicator, which itself has a
// property named "verbose", also served by a getter/setter:
// * The getter returns a boolean, indicating whether "verbose" is set.
// * The setter sets "verbose" on the instance data.
// 3. The setter sets "verbose" on the instance data.

class Addon {
public:
class VerboseIndicator : public Napi::ObjectWrap<VerboseIndicator> {
Expand Down

0 comments on commit 293ee15

Please sign in to comment.