1
0
forked from mirrors/0ad

Return the namespace of a module

To make it easy for the engine to access the exported values the
namespace is returned from the future.
This commit is contained in:
phosit
2025-01-15 21:34:58 +01:00
committed by phosit
parent d26d9b9b2b
commit 252df0a1db
10 changed files with 206 additions and 8 deletions
+8 -2
View File
@@ -49,10 +49,14 @@ public:
public:
struct Evaluating
{
JS::PersistentRootedObject moduleNamespace;
JS::PersistentRootedObject fulfill;
JS::PersistentRootedObject reject;
};
struct Fulfilled {};
struct Fulfilled
{
JS::PersistentRootedObject moduleNamespace;
};
struct Rejected
{
std::exception_ptr error;
@@ -72,8 +76,10 @@ public:
/**
* Throws if the evaluation of the module failed.
* @return The module namespace. All exported values are a property
* of this object. @c default is a property with name "default".
*/
void Get();
[[nodiscard]] JSObject* Get();
private:
// It's save to not require a `JS::HandleValue` here.