Files
react-native/ReactCommon/utils/RuntimeExecutor.h
T
Emily Janzer 7266ebda56 Move RuntimeExecutor declaration to react/utils
Summary: Right now RuntimeExecutor is only used in Fabric. Moving it out of Fabric's uimanager/primitives.h and into react/utils so we can use it more broadly.

Reviewed By: shergin

Differential Revision: D16385366

fbshipit-source-id: 96063e536e1480bac078a9376fe55f7d8750477e
2019-07-24 19:48:33 -07:00

26 lines
862 B
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>
namespace facebook {
namespace react {
/*
* Takes a function and calls it with a reference to a Runtime. The function
* will be called when it is safe to do so (i.e. it ensures non-concurrent
* access) and may be invoked asynchronously, depending on the implementation.
* If you need to access a Runtime, it's encouraged to use a RuntimeExecutor
* instead of storing a pointer to the Runtime itself, which makes it more
* difficult to ensure that the Runtime is being accessed safely.
*/
using RuntimeExecutor =
std::function<void(std::function<void(jsi::Runtime &runtime)> &&callback)>;
} // namespace react
} // namespace facebook