1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 
6 #include "FrozenObject.h"
7 #include "JSIStoreValueUser.h"
8 #include "SharedParent.h"
9 
10 using namespace facebook;
11 
12 namespace reanimated {
13 
14 class RemoteObject : public jsi::HostObject, public StoreUser {
15  private:
16   std::weak_ptr<jsi::Value> backing;
17   std::unique_ptr<FrozenObject> initializer;
18 
19  public:
20   void maybeInitializeOnWorkletRuntime(jsi::Runtime &rt);
RemoteObject(jsi::Runtime & rt,const jsi::Object & object,RuntimeManager * runtimeManager,std::shared_ptr<Scheduler> s)21   RemoteObject(
22       jsi::Runtime &rt,
23       const jsi::Object &object,
24       RuntimeManager *runtimeManager,
25       std::shared_ptr<Scheduler> s)
26       : StoreUser(s, *runtimeManager),
27         initializer(
28             std::make_unique<FrozenObject>(rt, object, runtimeManager)) {}
29   void
30   set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value);
31   jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name);
32   std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt);
33 };
34 
35 } // namespace reanimated
36