-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Derive class `TypeTaggable` from `Value`, and let it serve as the base class for `Object` and `External`. That way, the type tagging is implemented for both classes. Additionally, exclude deleted .js files from linting. Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com> Refs: #1293 PR-URL: #1298 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
- Loading branch information
1 parent
d4942cc
commit d013044
Showing
13 changed files
with
218 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# TypeTaggable | ||
|
||
Class `Napi::TypeTaggable` inherits from class [`Napi::Value`][]. | ||
|
||
The `Napi::TypeTaggable` class is the base class for [`Napi::Object`][] and | ||
[`Napi::External`][]. It adds type-tagging capabilities to both. It is an | ||
abstract-only base class. | ||
|
||
### TypeTag() | ||
|
||
```cpp | ||
void Napi::TypeTaggable::TypeTag(const napi_type_tag* type_tag) const; | ||
``` | ||
- `[in] type_tag`: The tag with which this object or external is to be marked. | ||
The `Napi::TypeTaggable::TypeTag()` method associates the value of the | ||
`type_tag` pointer with this JavaScript object or external. | ||
`Napi::TypeTaggable::CheckTypeTag()` can then be used to compare the tag that | ||
was attached with one owned by the add-on to ensure that this object or external | ||
has the right type. | ||
### CheckTypeTag() | ||
```cpp | ||
bool Napi::TypeTaggable::CheckTypeTag(const napi_type_tag* type_tag) const; | ||
``` | ||
|
||
- `[in] type_tag`: The tag with which to compare any tag found on this object or | ||
external. | ||
|
||
The `Napi::TypeTaggable::CheckTypeTag()` method compares the pointer given as | ||
`type_tag` with any that can be found on this JavaScript object or external. If | ||
no tag is found or if a tag is found but it does not match `type_tag`, then the | ||
return value is `false`. If a tag is found and it matches `type_tag`, then the | ||
return value is `true`. | ||
|
||
[`Napi::Value`]: ./value.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.