Changeset View
Changeset View
Standalone View
Standalone View
source/scriptinterface/ScriptInterface.h
Show All 18 Lines | |||||
#define INCLUDED_SCRIPTINTERFACE | #define INCLUDED_SCRIPTINTERFACE | ||||
#include "ps/Errors.h" | #include "ps/Errors.h" | ||||
#include "scriptinterface/ScriptConversions.h" | #include "scriptinterface/ScriptConversions.h" | ||||
#include "scriptinterface/ScriptExceptions.h" | #include "scriptinterface/ScriptExceptions.h" | ||||
#include "scriptinterface/ScriptRequest.h" | #include "scriptinterface/ScriptRequest.h" | ||||
#include "scriptinterface/ScriptTypes.h" | #include "scriptinterface/ScriptTypes.h" | ||||
#include "ps/FutureForward.h" | |||||
#include <map> | #include <map> | ||||
ERROR_GROUP(Scripting); | ERROR_GROUP(Scripting); | ||||
ERROR_TYPE(Scripting, SetupFailed); | ERROR_TYPE(Scripting, SetupFailed); | ||||
ERROR_SUBGROUP(Scripting, LoadFile); | ERROR_SUBGROUP(Scripting, LoadFile); | ||||
ERROR_TYPE(Scripting_LoadFile, OpenFailed); | ERROR_TYPE(Scripting_LoadFile, OpenFailed); | ||||
ERROR_TYPE(Scripting_LoadFile, EvalErrors); | ERROR_TYPE(Scripting_LoadFile, EvalErrors); | ||||
▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Evaluate some JS code in the global scope. | * Evaluate some JS code in the global scope. | ||||
* @return true on successful compilation and execution; false otherwise | * @return true on successful compilation and execution; false otherwise | ||||
*/ | */ | ||||
bool Eval(const char* code) const; | bool Eval(const char* code) const; | ||||
bool Eval(const char* code, JS::MutableHandleValue out) const; | bool Eval(const char* code, JS::MutableHandleValue out) const; | ||||
template<typename T> bool Eval(const char* code, T& out) const; | template<typename T> bool Eval(const char* code, T& out) const; | ||||
void AddJob(JS::HandleObject job); | |||||
void RunJobs(); | |||||
void AddPromise(JS::Heap<JSObject*>& promise, Future<std::function<JS::HandleValue(const ScriptRequest&)>>&& future); | |||||
void WaitOnPendingPromises(); | |||||
/** | /** | ||||
* Calls the random number generator assigned to this ScriptInterface instance and returns the generated number. | * Calls the random number generator assigned to this ScriptInterface instance and returns the generated number. | ||||
*/ | */ | ||||
bool MathRandom(double& nbr) const; | bool MathRandom(double& nbr) const; | ||||
/** | /** | ||||
* JSNative wrapper of the above. | * JSNative wrapper of the above. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator