/* * 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 #include namespace facebook::react { inline static jsi::Value valueFromTask( jsi::Runtime& runtime, std::shared_ptr task) { jsi::Object obj(runtime); obj.setNativeState(runtime, std::move(task)); return obj; } inline static std::shared_ptr taskFromValue( jsi::Runtime& runtime, const jsi::Value& value) { if (value.isNull()) { return nullptr; } return value.getObject(runtime).getNativeState(runtime); } } // namespace facebook::react