#pragma once #include #include #include #include #include #include "JSIStoreValueUser.h" #include "LayoutAnimationsProxy.h" #include "MutableValueSetterProxy.h" #include "RuntimeManager.h" #include "SharedParent.h" using namespace facebook; namespace reanimated { class MutableValue : public jsi::HostObject, public std::enable_shared_from_this, public StoreUser { private: friend MutableValueSetterProxy; friend LayoutAnimationsProxy; private: RuntimeManager *runtimeManager; std::mutex readWriteMutex; std::shared_ptr value; std::weak_ptr animation; std::map> listeners; public: void setValue(jsi::Runtime &rt, const jsi::Value &newValue); jsi::Value getValue(jsi::Runtime &rt); public: MutableValue( jsi::Runtime &rt, const jsi::Value &initial, RuntimeManager *runtimeManager, std::shared_ptr s); public: void set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value); jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name); std::vector getPropertyNames(jsi::Runtime &rt); unsigned long addListener( unsigned long listenerId, std::function listener); void removeListener(unsigned long listenerId); }; } // namespace reanimated