mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-06 20:45:34 +00:00
Add a function to query a global object, including JS classes, from C++
The latter are not properties of the global object but stored within the global lexical environment. This is not currently needed, but will be useful for future diffs. Update Vector2D/3D querying. Taken from D2746 This was SVN commit r24406.
This commit is contained in:
@@ -233,6 +233,15 @@ public:
|
||||
*/
|
||||
bool HasProperty(JS::HandleValue obj, const char* name) const;
|
||||
|
||||
/**
|
||||
* Get an object from the global scope or any lexical scope.
|
||||
* This can return globally accessible objects even if they are not properties
|
||||
* of the global object (e.g. ES6 class definitions).
|
||||
* @param name - Name of the property.
|
||||
* @param out The object or null.
|
||||
*/
|
||||
static bool GetGlobalProperty(const ScriptRequest& rq, const std::string& name, JS::MutableHandleValue out);
|
||||
|
||||
/**
|
||||
* Returns all properties of the object, both own properties and inherited.
|
||||
* This is essentially equivalent to calling Object.getOwnPropertyNames()
|
||||
|
||||
Reference in New Issue
Block a user