// // Created by Marc Rousavy on 27.03.24. // #pragma once #include "Dispatcher.hpp" #include namespace margelo::nitro { using namespace facebook; /** * A Dispatcher that uses react::CallInvoker for it's implementation */ class CallInvokerDispatcher final : public Dispatcher { public: explicit CallInvokerDispatcher(std::shared_ptr callInvoker) : _callInvoker(callInvoker) {} void runAsync(std::function&& function) override { _callInvoker->invokeAsync(std::move(function)); } void runSync(std::function&& function) override { _callInvoker->invokeSync(std::move(function)); } private: std::shared_ptr _callInvoker; }; } // namespace margelo::nitro