26 lines
848 B
C++
26 lines
848 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and 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::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 facebook::react
|