MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / Symbol

Class Symbol

napi.h:790–848  ·  view source on GitHub ↗

A JavaScript symbol value.

Source from the content-addressed store, hash-verified

788
789/// A JavaScript symbol value.
790class Symbol : public Name {
791 public:
792 /// Creates a new Symbol value with an optional description.
793 static Symbol New(
794 napi_env env, ///< Node-API environment
795 const char* description =
796 nullptr ///< Optional UTF-8 encoded null-terminated C string
797 /// describing the symbol
798 );
799
800 /// Creates a new Symbol value with a description.
801 static Symbol New(
802 napi_env env, ///< Node-API environment
803 const std::string&
804 description ///< UTF-8 encoded C++ string describing the symbol
805 );
806
807 /// Creates a new Symbol value with a description.
808 static Symbol New(
809 napi_env env, ///< Node-API environment
810 std::string_view
811 description ///< UTF-8 encoded C++ string view describing the symbol
812 );
813
814 /// Creates a new Symbol value with a description.
815 static Symbol New(napi_env env, ///< Node-API environment
816 String description ///< String value describing the symbol
817 );
818
819 /// Creates a new Symbol value with a description.
820 static Symbol New(
821 napi_env env, ///< Node-API environment
822 napi_value description ///< String value describing the symbol
823 );
824
825 /// Get a public Symbol (e.g. Symbol.iterator).
826 static MaybeOrValue<Symbol> WellKnown(napi_env, const std::string& name);
827
828 // Create a symbol in the global registry, UTF-8 Encoded cpp string
829 static MaybeOrValue<Symbol> For(napi_env env, const std::string& description);
830
831 // Create a symbol in the global registry, UTF-8 encoded cpp string view
832 static MaybeOrValue<Symbol> For(napi_env env, std::string_view description);
833
834 // Create a symbol in the global registry, C style string (null terminated)
835 static MaybeOrValue<Symbol> For(napi_env env, const char* description);
836
837 // Create a symbol in the global registry, String value describing the symbol
838 static MaybeOrValue<Symbol> For(napi_env env, String description);
839
840 // Create a symbol in the global registry, napi_value describing the symbol
841 static MaybeOrValue<Symbol> For(napi_env env, napi_value description);
842
843 static void CheckCast(napi_env env, napi_value value);
844
845 Symbol(); ///< Creates a new _empty_ Symbol instance.
846 Symbol(napi_env env,
847 napi_value value); ///< Wraps a Node-API value primitive.

Callers 7

napi-inl.hFile · 0.85
testFunction · 0.85
testFunction · 0.85
typeCheckerTestFunction · 0.85
accessPropTestFunction · 0.85
testFunction · 0.85

Calls

no outgoing calls

Tested by 3

testFunction · 0.68
testFunction · 0.68
testFunction · 0.68