Files
react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h
T
Samuel Susla dbda1917cc Make RuntimeScheduler module compile in C++ 14
Summary:
changelog: [internal]

Don't use C++ 17 features in RuntimeScheduler module as it needs to be imported into C++14 module.

Also removes redundant dependency.

Reviewed By: ShikaSD

Differential Revision: D30485642

fbshipit-source-id: 0a20f85c596eebe193affc815c8ca851fc72e46d
2021-09-01 11:26:27 -07:00

45 lines
1.2 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <jsi/jsi.h>
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
namespace facebook {
namespace react {
/*
* Exposes RuntimeScheduler to JavaScript realm.
*/
class RuntimeSchedulerBinding : public jsi::HostObject {
public:
RuntimeSchedulerBinding(
std::shared_ptr<RuntimeScheduler> const &runtimeScheduler);
/*
* Installs RuntimeSchedulerBinding into JavaScript runtime if needed.
* Creates and sets `RuntimeSchedulerBinding` into the global namespace.
* In case if the global namespace already has a `RuntimeSchedulerBinding`
* installed, returns that.
*/
static std::shared_ptr<RuntimeSchedulerBinding> createAndInstallIfNeeded(
jsi::Runtime &runtime,
std::shared_ptr<RuntimeScheduler> const &runtimeScheduler);
/*
* `jsi::HostObject` specific overloads.
*/
jsi::Value get(jsi::Runtime &runtime, jsi::PropNameID const &name) override;
private:
std::shared_ptr<RuntimeScheduler> runtimeScheduler_;
};
} // namespace react
} // namespace facebook