// Copyright © 2021-present 650 Industries, Inc. (aka Expo) #pragma once #include "JavaScriptObject.h" #include #include #include namespace jni = facebook::jni; namespace jsi = facebook::jsi; namespace expo { class JavaScriptRuntime; /** * Represents any JavaScript value. Its purpose is to expose the `jsi::Value` API back to Kotlin. */ class JavaScriptValue : public jni::HybridClass { public: static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/jni/JavaScriptValue;"; static auto constexpr TAG = "JavaScriptValue"; static void registerNatives(); JavaScriptValue( std::weak_ptr runtime, std::shared_ptr jsValue ); std::string kind(); bool isNull(); bool isUndefined(); bool isBool(); bool isNumber(); bool isString(); bool isSymbol(); bool isFunction(); bool isObject(); bool getBool(); double getDouble(); std::string getString(); jni::local_ref getObject(); private: friend HybridBase; std::weak_ptr runtimeHolder; std::shared_ptr jsValue; jni::local_ref jniKind(); jni::local_ref jniGetString(); }; } // namespace expo