| 2725 | } |
| 2726 | |
| 2727 | var ScriptingObjects::ScriptedLookAndFeel::callDefinedFunction(const Identifier& functionname, var* args, int numArgs) |
| 2728 | { |
| 2729 | // If this hits, you need to add that id to the array above. |
| 2730 | jassert(getAllFunctionNames().contains(functionname)); |
| 2731 | |
| 2732 | auto f = functions.getProperty(functionname, {}); |
| 2733 | |
| 2734 | if (HiseJavascriptEngine::isJavascriptFunction(f)) |
| 2735 | { |
| 2736 | SimpleReadWriteLock::ScopedReadLock sl(getScriptProcessor()->getMainController_()->getJavascriptThreadPool().getLookAndFeelRenderLock()); |
| 2737 | |
| 2738 | var thisObject(this); |
| 2739 | var::NativeFunctionArgs arg(thisObject, args, numArgs); |
| 2740 | auto engine = dynamic_cast<JavascriptProcessor*>(getScriptProcessor())->getScriptEngine(); |
| 2741 | Result r = Result::ok(); |
| 2742 | |
| 2743 | try |
| 2744 | { |
| 2745 | return engine->callExternalFunctionRaw(f, arg); |
| 2746 | } |
| 2747 | catch (String& errorMessage) |
| 2748 | { |
| 2749 | debugToConsole(dynamic_cast<Processor*>(getScriptProcessor()), errorMessage); |
| 2750 | } |
| 2751 | catch (HiseJavascriptEngine::RootObject::Error&) |
| 2752 | { |
| 2753 | |
| 2754 | } |
| 2755 | } |
| 2756 | |
| 2757 | return {}; |
| 2758 | } |
| 2759 | |
| 2760 | |
| 2761 |
no test coverage detected