mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
7266ebda56
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
26 lines
862 B
C++
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
|