1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-06 04:00:08 +00:00

Added method JavascriptEngine::stop()

This commit is contained in:
jules 2017-02-23 09:38:45 +00:00
parent 91d4ba9891
commit aa2598ffff
2 changed files with 5 additions and 1 deletions

View file

@ -222,7 +222,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
void checkTimeOut (const CodeLocation& location) const
{
if (Time::getCurrentTime() > root->timeout)
location.throwError ("Execution timed-out");
location.throwError (root->timeout == Time() ? "Interrupted" : "Execution timed-out");
}
};
@ -1794,6 +1794,7 @@ JavascriptEngine::JavascriptEngine() : maximumExecutionTime (15.0), root (new R
JavascriptEngine::~JavascriptEngine() {}
void JavascriptEngine::prepareTimeout() const noexcept { root->timeout = Time::getCurrentTime() + maximumExecutionTime; }
void JavascriptEngine::stop() noexcept { root->timeout = {}; }
void JavascriptEngine::registerNativeObject (const Identifier& name, DynamicObject* object)
{

View file

@ -98,6 +98,9 @@ public:
*/
RelativeTime maximumExecutionTime;
/** When called from another thread, causes the interpreter to time-out as soon as possible */
void stop() noexcept;
/** Provides access to the set of properties of the root namespace object. */
const NamedValueSet& getRootObjectProperties() const noexcept;