The Embind C++ class emscripten::val (defined in val.h) is used to transliterate JavaScript code to C++.
Guide material for this class can be found in Using val to transliterate JavaScript to C++.
This class is a C++ data type that can be used to represent (and provide convenient access to) any JavaScript object. You can use it to call a JavaScript object, read and write its properties, or coerce it to a C++ value like a bool, int, or std::string.
For example, the code below shows some simple JavaScript for making an XHR request on a URL:
var xhr = new XMLHttpRequest;
xhr.open("GET", "http://url");
This same code can be written in C++, using global() to get the symbol for the global XMLHttpRequest object and then using it to open a URL.
val xhr = val::global("XMLHttpRequest").new_();
xhr.call("open", std::string("GET"), std::string("http://url"));
See Using val to transliterate JavaScript to C++ for other examples.
Creates and returns a new Array.
Returns: | The new Array. |
---|
Creates and returns a new Object.
Returns: | The new Object. |
---|
Creates a val that represents undefined.
Returns: | The val that represents undefined. |
---|
Creates a val that represents null. val::undefined() is the same, but for undefined.
Returns: | A val that represents null. |
---|
HamishW-Replace with description.
Returns: | HamishW-Replace with description. |
---|
Looks up a global symbol.
Parameters const char* name: | |
---|---|
HamishW-Replace with description. | |
Returns: | HamishW-Replace with description. |
Looks up a symbol on the emscripten Module object.
Parameters const char* name: | |
---|---|
HamishW-Replace with description. | |
Returns: | HamishW-Replace with description. |
HamishW-Replace with description.
Parameters const char* name: | |
---|---|
HamishW-Replace with description. | |
Returns: | HamishW-Replace with description. |
Constructor.
A val can be constructed by explicit construction from any C++ type. For example, val(true) or val(std::string("foo")).
Parameters T&& value: | |
---|---|
Any C++ type. |
HamishW Don’t know how following “floating statement works”. Leaving here for discussion val() = delete;
HamishW-Replace with description.
Parameters const char* v: | |
---|---|
HamishW-Replace with description. |
HamishW-Replace with description.
Parameters val&& v: | |
---|---|
HamishW-Replace with description. |
HamishW-Replace with description.
Parameters const val& v: | |
---|---|
HamishW-Replace with description. |
Destructor. HamishW-Replace with further description or delete comment.
HamishW-Replace with description.
Parameters const val& v: | |
---|---|
HamishW-Replace with description. |
HamishW-Replace with description.
Parameters val&& v: | |
---|---|
HamishW-Replace with description. | |
Returns: | HamishW-Replace with description. |
HamishW-Replace with description.
Parameters val&& v: | |
---|---|
HamishW-Replace with description. | |
Returns: | HamishW-Replace with description. |
Test whether ... HamishW-Replace with description.
Parameters const char* key: | |
---|---|
HamishW-Replace with description. | |
Returns: | HamishW-Replace with description. |
prototype:
template<typename... Args>
val new_(Args&&... args) const
HamishW-Replace with description.
Parameters Args&&... args: | |
---|---|
HamishW-Replace with description. Note that this is a templated value. | |
Returns: | HamishW-Replace with description. |
HamishW-Replace with description.
Parameters const T& key: | |
---|---|
HamishW-Replace with description. Note that this is a templated value. | |
Returns: | HamishW-Replace with description. |
Set the specified (key) property of a JavaScript object (accessed through a val) with the value v. HamishW-Replace with description.
Parameters: |
|
---|
HamishW-Replace with description.
Parameters Args&&... args: | |
---|---|
HamishW-Replace with description. Note that this is a templated value. |
HamishW-Replace with description.
Parameters: |
|
---|
HamishW-Replace with description.
Returns: | HamishW-Replace with description. Note that this is a templated value. |
---|
HamishW-Replace with description.
Returns: | HamishW-Replace with description. |
---|
HamishW-Replace with description.
HamishW. I believe NOT internal. Please confirm.
Parameters val v: | |
---|---|
HamishW-Replace with description. | |
Returns: | HamishW-Replace with description. |