2016-05-04 02:29:58 +00:00
|
|
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2017-04-25 12:29:45 +00:00
|
|
|
#include <cxxreact/Executor.h>
|
2017-05-13 00:57:12 +00:00
|
|
|
#include <folly/dynamic.h>
|
2016-05-04 02:29:58 +00:00
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
|
|
|
struct MethodDescriptor {
|
|
|
|
std::string name;
|
|
|
|
// type is one of js MessageQueue.MethodTypes
|
|
|
|
std::string type;
|
|
|
|
|
|
|
|
MethodDescriptor(std::string n, std::string t)
|
|
|
|
: name(std::move(n))
|
|
|
|
, type(std::move(t)) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class NativeModule {
|
|
|
|
public:
|
|
|
|
virtual ~NativeModule() {}
|
|
|
|
virtual std::string getName() = 0;
|
|
|
|
virtual std::vector<MethodDescriptor> getMethods() = 0;
|
|
|
|
virtual folly::dynamic getConstants() = 0;
|
|
|
|
// TODO mhorowitz: do we need initialize()/onCatalystInstanceDestroy() in C++
|
|
|
|
// or only Java?
|
2017-05-13 00:57:12 +00:00
|
|
|
virtual void invoke(unsigned int reactMethodId, folly::dynamic&& params, int callId) = 0;
|
2017-04-25 12:29:45 +00:00
|
|
|
virtual MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0;
|
2016-05-04 02:29:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|