Browse Source

Added method JavascriptEngine::stop()

tags/2021-05-28
jules 8 years ago
parent
commit
aa2598ffff
2 changed files with 5 additions and 1 deletions
  1. +2
    -1
      modules/juce_core/javascript/juce_Javascript.cpp
  2. +3
    -0
      modules/juce_core/javascript/juce_Javascript.h

+ 2
- 1
modules/juce_core/javascript/juce_Javascript.cpp 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)
{


+ 3
- 0
modules/juce_core/javascript/juce_Javascript.h 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;


Loading…
Cancel
Save