expo-modules-core 1.11.13 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -13
- package/ExpoModulesCore.podspec +7 -4
- package/android/ExpoModulesCorePlugin.gradle +40 -28
- package/android/build.gradle +12 -93
- package/android/proguard-rules.pro +0 -8
- package/android/src/main/cpp/Exceptions.cpp +1 -1
- package/android/src/main/cpp/Exceptions.h +1 -1
- package/android/src/main/cpp/ExpoModulesHostObject.cpp +7 -6
- package/android/src/main/cpp/ExpoModulesHostObject.h +3 -3
- package/android/src/main/cpp/JNIInjector.cpp +4 -2
- package/android/src/main/cpp/JSIContext.cpp +354 -0
- package/android/src/main/cpp/{JSIInteropModuleRegistry.h → JSIContext.h} +90 -9
- package/android/src/main/cpp/JavaCallback.cpp +210 -24
- package/android/src/main/cpp/JavaCallback.h +42 -7
- package/android/src/main/cpp/JavaScriptFunction.cpp +20 -6
- package/android/src/main/cpp/JavaScriptFunction.h +4 -1
- package/android/src/main/cpp/JavaScriptModuleObject.cpp +118 -82
- package/android/src/main/cpp/JavaScriptModuleObject.h +21 -18
- package/android/src/main/cpp/JavaScriptObject.cpp +7 -8
- package/android/src/main/cpp/JavaScriptObject.h +4 -2
- package/android/src/main/cpp/JavaScriptRuntime.cpp +18 -41
- package/android/src/main/cpp/JavaScriptRuntime.h +2 -8
- package/android/src/main/cpp/JavaScriptTypedArray.cpp +3 -3
- package/android/src/main/cpp/JavaScriptTypedArray.h +1 -1
- package/android/src/main/cpp/JavaScriptValue.cpp +7 -7
- package/android/src/main/cpp/JavaScriptValue.h +1 -1
- package/android/src/main/cpp/JavaScriptWeakObject.cpp +4 -4
- package/android/src/main/cpp/JavaScriptWeakObject.h +1 -1
- package/android/src/main/cpp/MethodMetadata.cpp +44 -120
- package/android/src/main/cpp/MethodMetadata.h +5 -11
- package/android/src/main/cpp/WeakRuntimeHolder.cpp +3 -3
- package/android/src/main/cpp/WeakRuntimeHolder.h +2 -2
- package/android/src/main/cpp/types/AnyType.cpp +1 -1
- package/android/src/main/cpp/types/AnyType.h +1 -1
- package/android/src/main/cpp/types/FrontendConverter.cpp +32 -43
- package/android/src/main/cpp/types/FrontendConverter.h +1 -23
- package/android/src/main/cpp/types/JNIToJSIConverter.cpp +5 -10
- package/android/src/main/cpp/types/JNIToJSIConverter.h +6 -2
- package/android/src/main/java/expo/modules/adapters/react/ModuleRegistryAdapter.java +3 -0
- package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +14 -100
- package/android/src/main/java/expo/modules/adapters/react/ReactAdapterPackage.java +3 -5
- package/android/src/main/java/expo/modules/adapters/react/ReactModuleRegistryProvider.java +6 -22
- package/android/src/main/java/expo/modules/adapters/react/apploader/RNHeadlessAppLoader.kt +8 -4
- package/android/src/main/java/expo/modules/adapters/react/services/EventEmitterModule.java +0 -1
- package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +23 -8
- package/android/src/main/java/expo/modules/core/BasePackage.java +0 -10
- package/android/src/main/java/expo/modules/core/ModulePriorities.kt +1 -0
- package/android/src/main/java/expo/modules/core/ModuleRegistry.java +2 -32
- package/android/src/main/java/expo/modules/core/ModuleRegistryProvider.java +0 -18
- package/android/src/main/java/expo/modules/core/Promise.java +2 -0
- package/android/src/main/java/expo/modules/core/interfaces/Package.java +0 -17
- package/android/src/main/java/expo/modules/core/interfaces/ReactActivityHandler.java +0 -9
- package/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +24 -31
- package/android/src/main/java/expo/modules/core/logging/LogHandler.kt +1 -7
- package/android/src/main/java/expo/modules/core/logging/LogHandlers.kt +11 -0
- package/android/src/main/java/expo/modules/core/logging/Logger.kt +18 -29
- package/android/src/main/java/expo/modules/core/logging/LoggerTimer.kt +11 -0
- package/android/src/main/java/expo/modules/core/logging/OSLogHandler.kt +2 -4
- package/android/src/main/java/expo/modules/core/logging/PersistentFileLogHandler.kt +1 -3
- package/android/src/main/java/expo/modules/interfaces/constants/ConstantsInterface.java +0 -2
- package/android/src/main/java/expo/modules/interfaces/permissions/PermissionsStatus.java +1 -1
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +44 -24
- package/android/src/main/java/expo/modules/kotlin/ArrayExtenstions.kt +15 -0
- package/android/src/main/java/expo/modules/kotlin/CoreLogger.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/DynamicExtenstions.kt +0 -3
- package/android/src/main/java/expo/modules/kotlin/ExpoBridgeModule.kt +41 -0
- package/android/src/main/java/expo/modules/kotlin/ExpoModulesHelper.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/KPromiseWrapper.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +1 -33
- package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +7 -6
- package/android/src/main/java/expo/modules/kotlin/ModuleRegistry.kt +12 -12
- package/android/src/main/java/expo/modules/kotlin/Promise.kt +10 -0
- package/android/src/main/java/expo/modules/kotlin/ReactExtensions.kt +14 -0
- package/android/src/main/java/expo/modules/kotlin/Utils.kt +4 -1
- package/android/src/main/java/expo/modules/kotlin/activityaware/AppCompatActivityAwareHelper.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultCaller.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt +6 -6
- package/android/src/main/java/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +44 -15
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/CoreModule.kt +31 -1
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +2 -4
- package/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt +11 -4
- package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +2 -3
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +136 -43
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionComponent.kt +71 -2
- package/android/src/main/java/expo/modules/kotlin/functions/FunctionBuilder.kt +39 -12
- package/android/src/main/java/expo/modules/kotlin/jni/ExpectedType.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/jni/JNIDeallocator.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/jni/{JSIInteropModuleRegistry.kt → JSIContext.kt} +90 -14
- package/android/src/main/java/expo/modules/kotlin/jni/JavaCallback.kt +51 -24
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptFunction.kt +3 -3
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptModuleObject.kt +4 -1
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptObject.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptValue.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/jni/PromiseImpl.kt +20 -0
- package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +0 -1
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +164 -65
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponentBuilder.kt +3 -4
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/ClassRegistry.kt +21 -0
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObject.kt +34 -1
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +23 -8
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedRef.kt +7 -1
- package/android/src/main/java/expo/modules/kotlin/tracing/ExpoTrace.kt +4 -0
- package/android/src/main/java/expo/modules/kotlin/types/AnyType.kt +134 -2
- package/android/src/main/java/expo/modules/kotlin/types/EnforceType.kt +60 -0
- package/android/src/main/java/expo/modules/kotlin/types/EnumTypeConverter.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +0 -2
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +3 -27
- package/android/src/main/java/expo/modules/kotlin/types/UnitTypeConverter.kt +3 -7
- package/android/src/main/java/expo/modules/kotlin/types/io/PathTypeConverter.kt +3 -0
- package/android/src/main/java/expo/modules/kotlin/viewevent/ViewEvent.kt +2 -5
- package/android/src/main/java/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +137 -48
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +2 -5
- package/build/EventEmitter.d.ts +2 -2
- package/build/EventEmitter.d.ts.map +1 -1
- package/build/EventEmitter.js +8 -8
- package/build/EventEmitter.js.map +1 -1
- package/build/NativeModule.d.ts +4 -0
- package/build/NativeModule.d.ts.map +1 -0
- package/build/NativeModule.js +4 -0
- package/build/NativeModule.js.map +1 -0
- package/build/NativeModulesProxy.native.d.ts.map +1 -1
- package/build/NativeModulesProxy.native.js +4 -0
- package/build/NativeModulesProxy.native.js.map +1 -1
- package/build/NativeModulesProxy.types.d.ts +2 -2
- package/build/NativeModulesProxy.types.d.ts.map +1 -1
- package/build/NativeModulesProxy.types.js.map +1 -1
- package/build/NativeViewManagerAdapter.native.d.ts.map +1 -1
- package/build/NativeViewManagerAdapter.native.js +20 -1
- package/build/NativeViewManagerAdapter.native.js.map +1 -1
- package/build/PermissionsHook.d.ts.map +1 -1
- package/build/PermissionsHook.js +2 -0
- package/build/PermissionsHook.js.map +1 -1
- package/build/Refs.d.ts +8 -0
- package/build/Refs.d.ts.map +1 -0
- package/build/Refs.js +10 -0
- package/build/Refs.js.map +1 -0
- package/build/SharedObject.d.ts +4 -0
- package/build/SharedObject.d.ts.map +1 -0
- package/build/SharedObject.js +4 -0
- package/build/SharedObject.js.map +1 -0
- package/build/createWebModule.d.ts +2 -0
- package/build/createWebModule.d.ts.map +1 -0
- package/build/createWebModule.js +6 -0
- package/build/createWebModule.js.map +1 -0
- package/build/createWebModule.web.d.ts +2 -0
- package/build/createWebModule.web.d.ts.map +1 -0
- package/build/createWebModule.web.js +6 -0
- package/build/createWebModule.web.js.map +1 -0
- package/build/ensureNativeModulesAreInstalled.d.ts +6 -0
- package/build/ensureNativeModulesAreInstalled.d.ts.map +1 -0
- package/build/ensureNativeModulesAreInstalled.js +26 -0
- package/build/ensureNativeModulesAreInstalled.js.map +1 -0
- package/build/hooks/useReleasingSharedObject.d.ts +7 -0
- package/build/hooks/useReleasingSharedObject.d.ts.map +1 -0
- package/build/hooks/useReleasingSharedObject.js +40 -0
- package/build/hooks/useReleasingSharedObject.js.map +1 -0
- package/build/index.d.ts +8 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/requireNativeModule.d.ts +0 -17
- package/build/requireNativeModule.d.ts.map +1 -1
- package/build/requireNativeModule.js +2 -23
- package/build/requireNativeModule.js.map +1 -1
- package/build/ts-declarations/EventEmitter.d.ts +50 -0
- package/build/ts-declarations/EventEmitter.d.ts.map +1 -0
- package/build/ts-declarations/EventEmitter.js +2 -0
- package/build/ts-declarations/EventEmitter.js.map +1 -0
- package/build/ts-declarations/NativeModule.d.ts +14 -0
- package/build/ts-declarations/NativeModule.d.ts.map +1 -0
- package/build/ts-declarations/NativeModule.js +2 -0
- package/build/ts-declarations/NativeModule.js.map +1 -0
- package/build/ts-declarations/SharedObject.d.ts +14 -0
- package/build/ts-declarations/SharedObject.d.ts.map +1 -0
- package/build/ts-declarations/SharedObject.js +2 -0
- package/build/ts-declarations/SharedObject.js.map +1 -0
- package/build/ts-declarations/global.d.ts +49 -0
- package/build/ts-declarations/global.d.ts.map +1 -0
- package/build/ts-declarations/global.js +2 -0
- package/build/ts-declarations/global.js.map +1 -0
- package/build/web/CoreModule.d.ts +17 -0
- package/build/web/CoreModule.d.ts.map +1 -0
- package/build/web/CoreModule.js +51 -0
- package/build/web/CoreModule.js.map +1 -0
- package/build/web/index.d.ts +1 -0
- package/build/web/index.d.ts.map +1 -0
- package/build/web/index.js +1 -0
- package/build/web/index.js.map +1 -0
- package/build/web/index.web.d.ts +2 -0
- package/build/web/index.web.d.ts.map +1 -0
- package/build/web/index.web.js +2 -0
- package/build/web/index.web.js.map +1 -0
- package/common/cpp/BridgelessJSCallInvoker.h +41 -0
- package/common/cpp/EventEmitter.cpp +299 -0
- package/common/cpp/EventEmitter.h +111 -0
- package/common/cpp/JSIUtils.cpp +116 -11
- package/common/cpp/JSIUtils.h +54 -7
- package/common/cpp/LazyObject.cpp +15 -3
- package/common/cpp/LazyObject.h +13 -0
- package/common/cpp/NativeModule.cpp +16 -0
- package/common/cpp/NativeModule.h +34 -0
- package/common/cpp/ObjectDeallocator.cpp +3 -5
- package/common/cpp/ObjectDeallocator.h +2 -3
- package/common/cpp/SharedObject.cpp +69 -0
- package/common/cpp/SharedObject.h +59 -0
- package/common/cpp/TestingSyncJSCallInvoker.h +44 -0
- package/ios/Api/Builders/ClassComponentBuilder.swift +34 -0
- package/ios/{Objects → Api/Builders}/ObjectDefinitionBuilder.swift +3 -3
- package/ios/Api/Builders/ViewDefinitionBuilder.swift +53 -0
- package/ios/Api/Factories/AsyncFunctionFactories.swift +173 -0
- package/ios/{Classes/ClassComponentFactories.swift → Api/Factories/ClassFactories.swift} +19 -19
- package/ios/{Functions/ConcurrentFunctionDefinition.swift → Api/Factories/ConcurrentFunctionFactories.swift} +0 -113
- package/ios/{Modules/ModuleDefinitionComponents.swift → Api/Factories/EventListenersFactories.swift} +0 -20
- package/ios/Api/Factories/ModuleFactories.swift +6 -0
- package/ios/{Objects/ObjectDefinitionComponents.swift → Api/Factories/ObjectFactories.swift} +5 -5
- package/ios/Api/Factories/PropertyFactories.swift +50 -0
- package/ios/Api/Factories/SyncFunctionFactories.swift +173 -0
- package/ios/{Views/ViewManagerDefinitionComponents.swift → Api/Factories/ViewFactories.swift} +7 -6
- package/ios/AppDelegates/EXAppDelegateWrapper.h +0 -21
- package/ios/AppDelegates/EXAppDelegateWrapper.mm +37 -29
- package/ios/{AppContext.swift → Core/AppContext.swift} +34 -11
- package/ios/Core/Classes/AnyClassDefinitionElement.swift +37 -0
- package/ios/{Classes/ClassComponent.swift → Core/Classes/ClassDefinition.swift} +10 -10
- package/ios/{Conversions.swift → Core/Conversions.swift} +1 -1
- package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicSharedObjectType.swift +3 -3
- package/ios/Core/Events/EventObservingDefinition.swift +79 -0
- package/ios/Core/Events/LegacyEventEmitterCompat.swift +32 -0
- package/ios/Core/ExpoBridgeModule.h +18 -0
- package/ios/Core/ExpoBridgeModule.mm +88 -0
- package/ios/Core/ExpoRuntime.swift +6 -0
- package/ios/{Functions/AnyFunction.swift → Core/Functions/AnyFunctionDefinition.swift} +9 -2
- package/ios/Core/Functions/AsyncFunctionDefinition.swift +150 -0
- package/ios/Core/Functions/ConcurrentFunctionDefinition.swift +112 -0
- package/ios/Core/Functions/SyncFunctionDefinition.swift +108 -0
- package/ios/{JavaScriptUtils.swift → Core/JavaScriptUtils.swift} +4 -4
- package/ios/{Logging → Core/Logging}/LogHandlers.swift +12 -5
- package/ios/{Logging → Core/Logging}/Logger.swift +14 -92
- package/ios/Core/Logging/LoggerTimer.swift +22 -0
- package/ios/{ModuleHolder.swift → Core/ModuleHolder.swift} +2 -10
- package/ios/Core/Modules/CoreModule.swift +43 -0
- package/ios/{Modules → Core/Modules}/ModuleDefinition.swift +20 -12
- package/ios/{Modules → Core/Modules}/ModuleDefinitionBuilder.swift +1 -3
- package/ios/{Objects → Core/Objects}/ObjectDefinition.swift +9 -9
- package/ios/{Objects/PropertyComponent.swift → Core/Objects/PropertyDefinition.swift} +11 -64
- package/ios/Core/Protocols/AnyDefinition.swift +4 -0
- package/ios/Core/Protocols/AnyExpoView.swift +7 -0
- package/ios/Core/Protocols/AnyModule.swift +17 -0
- package/ios/Core/Protocols/AnyViewDefinition.swift +34 -0
- package/ios/Core/SharedObjects/SharedObject.swift +80 -0
- package/ios/{SharedObjects → Core/SharedObjects}/SharedObjectRegistry.swift +45 -19
- package/ios/{Views → Core/Views}/AnyViewProp.swift +1 -1
- package/ios/{Views → Core/Views}/ComponentData.swift +7 -7
- package/ios/{Views → Core/Views}/ExpoView.swift +1 -1
- package/ios/Core/Views/ViewDefinition.swift +97 -0
- package/ios/{Views → Core/Views}/ViewLifecycleMethod.swift +1 -1
- package/ios/{Views → Core/Views}/ViewModuleWrapper.swift +1 -1
- package/ios/Fabric/ExpoFabricView.swift +5 -6
- package/ios/FileSystemUtilities/FileSystemLegacyUtilities.swift +111 -0
- package/ios/JSI/EXJSIInstaller.h +28 -0
- package/ios/JSI/EXJSIInstaller.mm +54 -10
- package/ios/JSI/EXJSIUtils.h +15 -11
- package/ios/JSI/EXJSIUtils.mm +21 -49
- package/ios/JSI/EXJavaScriptObject.mm +2 -2
- package/ios/JSI/EXJavaScriptRuntime.h +15 -0
- package/ios/JSI/EXJavaScriptRuntime.mm +53 -26
- package/ios/JSI/EXSharedObjectUtils.h +15 -0
- package/ios/JSI/EXSharedObjectUtils.mm +18 -0
- package/ios/JSI/JavaScriptRuntime.swift +16 -0
- package/ios/Legacy/ModuleRegistry/EXModuleRegistry.m +1 -0
- package/ios/Legacy/ModuleRegistryProvider/EXModuleRegistryProvider.m +5 -0
- package/ios/Legacy/NativeModulesProxy/EXNativeModulesProxy.mm +5 -4
- package/ios/Legacy/Services/EXReactNativeAdapter.mm +34 -28
- package/ios/ReactDelegates/EXReactDelegateWrapper.h +4 -12
- package/ios/ReactDelegates/EXReactDelegateWrapper.mm +41 -0
- package/ios/ReactDelegates/EXReactRootViewFactory.h +38 -0
- package/ios/ReactDelegates/EXReactRootViewFactory.mm +54 -0
- package/ios/ReactDelegates/ExpoReactDelegate.swift +22 -15
- package/ios/ReactDelegates/ExpoReactDelegateHandler.swift +10 -21
- package/ios/ReactDelegates/RCTAppDelegate+Recreate.h +28 -0
- package/ios/ReactDelegates/RCTAppDelegate+Recreate.mm +47 -0
- package/ios/Tests/{ClassComponentSpec.swift → ClassDefinitionSpec.swift} +6 -6
- package/ios/Tests/ConvertiblesSpec.swift +6 -1
- package/ios/Tests/CoreModuleSpec.swift +0 -4
- package/ios/Tests/DynamicTypeSpec.swift +1 -1
- package/ios/Tests/EventEmitterSpec.swift +274 -0
- package/ios/Tests/ExceptionsSpec.swift +114 -54
- package/ios/Tests/ExpoModulesSpec.swift +4 -3
- package/ios/Tests/LoggerSpec.swift +80 -0
- package/ios/Tests/{PropertyComponentSpec.swift → PropertyDefinitionSpec.swift} +1 -1
- package/ios/Tests/SharedObjectRegistrySpec.swift +34 -28
- package/ios/Tests/SharedObjectSpec.swift +141 -0
- package/ios/Tests/ViewDefinitionSpec.swift +1 -1
- package/package.json +2 -2
- package/src/EventEmitter.ts +15 -18
- package/src/NativeModule.ts +6 -0
- package/src/NativeModulesProxy.native.ts +5 -0
- package/src/NativeModulesProxy.types.ts +2 -2
- package/src/NativeViewManagerAdapter.native.tsx +25 -1
- package/src/PermissionsHook.ts +4 -0
- package/src/Refs.ts +10 -0
- package/src/SharedObject.ts +6 -0
- package/src/createWebModule.ts +5 -0
- package/src/createWebModule.web.ts +6 -0
- package/src/ensureNativeModulesAreInstalled.ts +24 -0
- package/src/hooks/useReleasingSharedObject.ts +51 -0
- package/src/index.ts +13 -0
- package/src/requireNativeModule.ts +2 -51
- package/src/ts-declarations/EventEmitter.ts +65 -0
- package/src/ts-declarations/ExpoModules.d.ts +0 -5
- package/src/ts-declarations/NativeModule.ts +18 -0
- package/src/ts-declarations/SharedObject.ts +16 -0
- package/src/ts-declarations/global.ts +60 -0
- package/src/web/CoreModule.ts +83 -0
- package/src/web/index.ts +0 -0
- package/src/web/index.web.ts +1 -0
- package/android/src/main/cpp/JSIInteropModuleRegistry.cpp +0 -196
- package/android/src/main/java/expo/modules/adapters/react/ArgumentsHelper.java +0 -48
- package/android/src/main/java/expo/modules/adapters/react/PromiseWrapper.java +0 -38
- package/android/src/main/java/expo/modules/adapters/react/services/CookieManagerModule.java +0 -53
- package/android/src/main/java/expo/modules/core/ArgumentsHelper.java +0 -44
- package/android/src/main/java/expo/modules/core/ExportedModule.java +0 -173
- package/android/src/main/java/expo/modules/core/ModuleRegistryDelegate.kt +0 -12
- package/android/src/main/java/expo/modules/core/ViewManager.java +0 -9
- package/android/src/main/java/expo/modules/core/interfaces/ExpoMethod.java +0 -12
- package/android/src/main/java/expo/modules/core/interfaces/ExpoProp.java +0 -10
- package/android/src/main/java/expo/modules/core/logging/LoggerOptions.kt +0 -29
- package/android-annotation/build.gradle +0 -48
- package/android-annotation/src/main/java/expo/modules/annotation/Config.kt +0 -7
- package/android-annotation/src/main/java/expo/modules/annotation/ConverterBinder.kt +0 -7
- package/android-annotation-processor/build.gradle +0 -54
- package/android-annotation-processor/src/main/java/expo/modules/annotationprocessor/ExpoSymbolProcessor.kt +0 -175
- package/android-annotation-processor/src/main/java/expo/modules/annotationprocessor/ExpoSymbolProcessorProvider.kt +0 -10
- package/android-annotation-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider +0 -1
- package/ios/Classes/ClassComponentElement.swift +0 -37
- package/ios/Classes/ClassComponentElementsBuilder.swift +0 -34
- package/ios/ExpoBridgeModule.m +0 -7
- package/ios/ExpoBridgeModule.swift +0 -108
- package/ios/ExpoRuntime.swift +0 -28
- package/ios/Functions/AsyncFunctionComponent.swift +0 -327
- package/ios/Functions/SyncFunctionComponent.swift +0 -282
- package/ios/Interfaces/Font/EXFontManagerInterface.h +0 -9
- package/ios/Interfaces/Font/EXFontProcessorInterface.h +0 -15
- package/ios/Interfaces/Font/EXFontScalerInterface.h +0 -9
- package/ios/Interfaces/Font/EXFontScalersManagerInterface.h +0 -9
- package/ios/Legacy/Services/EXReactFontManager.h +0 -6
- package/ios/Legacy/Services/EXReactFontManager.m +0 -130
- package/ios/Modules/AnyModule.swift +0 -53
- package/ios/Modules/CoreModule.swift +0 -17
- package/ios/ReactDelegates/EXRCTBridgeDelegateInterceptor.h +0 -16
- package/ios/ReactDelegates/EXRCTBridgeDelegateInterceptor.m +0 -49
- package/ios/ReactDelegates/EXReactCompatibleHelpers.h +0 -15
- package/ios/ReactDelegates/EXReactCompatibleHelpers.m +0 -25
- package/ios/ReactDelegates/EXReactDelegateWrapper.m +0 -53
- package/ios/SharedObjects/SharedObject.swift +0 -31
- package/ios/Views/ViewDefinition.swift +0 -114
- package/ios/Views/ViewFactory.swift +0 -16
- package/ios/Views/ViewManagerDefinition.swift +0 -77
- package/ios/Views/ViewManagerDefinitionBuilder.swift +0 -11
- /package/ios/{AppContextConfig.swift → Core/AppContextConfig.swift} +0 -0
- /package/ios/{Arguments → Core/Arguments}/AnyArgument.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Convertible.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Convertibles.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Enumerable.swift +0 -0
- /package/ios/{Classes → Core/Classes}/ClassRegistry.swift +0 -0
- /package/ios/{Convertibles → Core/Convertibles}/Convertibles+Color.swift +0 -0
- /package/ios/{Convertibles → Core/Convertibles}/Either.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/AnyDynamicType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicArrayType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicConvertibleType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicDataType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicDictionaryType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicEnumType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicJavaScriptType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicOptionalType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicRawType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicTypedArrayType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicViewType.swift +0 -0
- /package/ios/{EventListener.swift → Core/EventListener.swift} +0 -0
- /package/ios/{Events → Core/Events}/Callback.swift +0 -0
- /package/ios/{Events → Core/Events}/EventDispatcher.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/ChainableException.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/CodedError.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/CommonExceptions.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/Exception.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/ExceptionOrigin.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/GenericException.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/UnexpectedException.swift +0 -0
- /package/ios/{JavaScriptFunction.swift → Core/JavaScriptFunction.swift} +0 -0
- /package/ios/{Logging → Core/Logging}/LogType.swift +0 -0
- /package/ios/{Logging → Core/Logging}/PersistentFileLog.swift +0 -0
- /package/ios/{ModuleRegistry.swift → Core/ModuleRegistry.swift} +0 -0
- /package/ios/{Modules → Core/Modules}/Module.swift +0 -0
- /package/ios/{ModulesProvider.swift → Core/ModulesProvider.swift} +0 -0
- /package/ios/{Objects → Core/Objects}/JavaScriptObjectBuilder.swift +0 -0
- /package/ios/{Promise.swift → Core/Promise.swift} +0 -0
- /package/ios/{Records → Core/Records}/AnyField.swift +0 -0
- /package/ios/{Records → Core/Records}/Field.swift +0 -0
- /package/ios/{Records → Core/Records}/FieldExtensions.swift +0 -0
- /package/ios/{Records → Core/Records}/FieldOption.swift +0 -0
- /package/ios/{Records → Core/Records}/Record.swift +0 -0
- /package/ios/{SharedObjects → Core/SharedObjects}/SharedRef.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/AnyTypedArray.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/ConcreteTypedArrays.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/GenericTypedArray.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/TypedArray.swift +0 -0
- /package/ios/{Views → Core/Views}/ConcreteViewProp.swift +0 -0
|
@@ -21,11 +21,10 @@ public class ExpoFabricView: ExpoFabricViewObjC {
|
|
|
21
21
|
return appContext?.moduleRegistry.get(moduleHolderForName: moduleName)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
/**
|
|
26
25
|
A dictionary of prop objects that contain prop setters.
|
|
27
26
|
*/
|
|
28
|
-
lazy var viewManagerPropDict: [String: AnyViewProp]? = moduleHolder?.
|
|
27
|
+
lazy var viewManagerPropDict: [String: AnyViewProp]? = moduleHolder?.definition.view?.propsDict()
|
|
29
28
|
|
|
30
29
|
// MARK: - Initializers
|
|
31
30
|
|
|
@@ -62,10 +61,10 @@ public class ExpoFabricView: ExpoFabricViewObjC {
|
|
|
62
61
|
Calls lifecycle methods registered by `OnViewDidUpdateProps` definition component.
|
|
63
62
|
*/
|
|
64
63
|
public override func viewDidUpdateProps() {
|
|
65
|
-
guard let view = contentView, let
|
|
64
|
+
guard let view = contentView, let viewDefinition = moduleHolder?.definition.view else {
|
|
66
65
|
return
|
|
67
66
|
}
|
|
68
|
-
|
|
67
|
+
viewDefinition.callLifecycleMethods(withType: .didUpdateProps, forView: view)
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
/**
|
|
@@ -110,7 +109,7 @@ public class ExpoFabricView: ExpoFabricViewObjC {
|
|
|
110
109
|
guard let appContext = appContext else {
|
|
111
110
|
fatalError(Exceptions.AppContextLost().reason)
|
|
112
111
|
}
|
|
113
|
-
guard let view = moduleHolder?.definition.
|
|
112
|
+
guard let view = moduleHolder?.definition.view?.createView(appContext: appContext) else {
|
|
114
113
|
fatalError("Cannot create a view from module '\(moduleName)'")
|
|
115
114
|
}
|
|
116
115
|
// Setting the content view automatically adds the view as a subview.
|
|
@@ -125,7 +124,7 @@ public class ExpoFabricView: ExpoFabricViewObjC {
|
|
|
125
124
|
guard let view = contentView, let moduleHolder = moduleHolder else {
|
|
126
125
|
return
|
|
127
126
|
}
|
|
128
|
-
moduleHolder.
|
|
127
|
+
moduleHolder.definition.view?.eventNames.forEach { eventName in
|
|
129
128
|
installEventDispatcher(forEvent: eventName, onView: view) { [weak self] (body: [String: Any]) in
|
|
130
129
|
if let self = self {
|
|
131
130
|
self.dispatchEvent(eventName, payload: body)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright 2023-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import Foundation
|
|
4
|
+
|
|
5
|
+
@objc(EXFileSystemLegacyUtilities)
|
|
6
|
+
public class FileSystemLegacyUtilities: NSObject, EXInternalModule, EXFileSystemInterface, EXFilePermissionModuleInterface {
|
|
7
|
+
@objc
|
|
8
|
+
public var documentDirectory: String
|
|
9
|
+
|
|
10
|
+
@objc
|
|
11
|
+
public var cachesDirectory: String
|
|
12
|
+
|
|
13
|
+
var isScoped: Bool = false
|
|
14
|
+
|
|
15
|
+
@objc
|
|
16
|
+
public init(documentDirectory: String, cachesDirectory: String) {
|
|
17
|
+
self.documentDirectory = documentDirectory
|
|
18
|
+
self.cachesDirectory = cachesDirectory
|
|
19
|
+
self.isScoped = true
|
|
20
|
+
|
|
21
|
+
super.init()
|
|
22
|
+
ensureDirExists(withPath: self.cachesDirectory)
|
|
23
|
+
ensureDirExists(withPath: self.documentDirectory)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
required public override init() {
|
|
27
|
+
let documentPaths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
|
|
28
|
+
self.documentDirectory = documentPaths[0]
|
|
29
|
+
|
|
30
|
+
let cachesPaths = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true)
|
|
31
|
+
self.cachesDirectory = cachesPaths[0]
|
|
32
|
+
|
|
33
|
+
super.init()
|
|
34
|
+
ensureDirExists(withPath: self.cachesDirectory)
|
|
35
|
+
ensureDirExists(withPath: self.documentDirectory)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static func exportedInterfaces() -> [Protocol] {
|
|
39
|
+
return [EXFileSystemInterface.self, EXFilePermissionModuleInterface.self]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@objc
|
|
43
|
+
public func permissions(forURI uri: URL) -> EXFileSystemPermissionFlags {
|
|
44
|
+
let validSchemas = [
|
|
45
|
+
"assets-library",
|
|
46
|
+
"http",
|
|
47
|
+
"https",
|
|
48
|
+
"ph"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
if validSchemas.contains(uri.scheme ?? "") {
|
|
52
|
+
return EXFileSystemPermissionFlags.read
|
|
53
|
+
}
|
|
54
|
+
if uri.scheme == "file" {
|
|
55
|
+
return getPathPermissions(uri.absoluteString)
|
|
56
|
+
}
|
|
57
|
+
return []
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@objc
|
|
61
|
+
public func generatePath(inDirectory directory: String, withExtension ext: String) -> String {
|
|
62
|
+
let fileName = "\(UUID().uuidString)\(ext)"
|
|
63
|
+
ensureDirExists(withPath: directory)
|
|
64
|
+
return (directory as NSString).appendingPathComponent(fileName)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@objc
|
|
68
|
+
public func ensureDirExists(withPath path: String) -> Bool {
|
|
69
|
+
let url = URL(fileURLWithPath: path)
|
|
70
|
+
return FileSystemUtilities.ensureDirExists(at: url)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@objc
|
|
74
|
+
public func getPathPermissions(_ path: String) -> EXFileSystemPermissionFlags {
|
|
75
|
+
guard let url = URL(string: path) else {
|
|
76
|
+
return []
|
|
77
|
+
}
|
|
78
|
+
let permissionsForInternalDirectories = getInternalPathPermissions(url)
|
|
79
|
+
if !permissionsForInternalDirectories.isEmpty {
|
|
80
|
+
return permissionsForInternalDirectories
|
|
81
|
+
}
|
|
82
|
+
return getExternalPathPermissions(url)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@objc
|
|
86
|
+
public func getInternalPathPermissions(_ url: URL) -> EXFileSystemPermissionFlags {
|
|
87
|
+
let scopedDirs: [String] = [cachesDirectory, documentDirectory]
|
|
88
|
+
let standardizedPath = url.standardized.path
|
|
89
|
+
for scopedDirectory in scopedDirs {
|
|
90
|
+
if standardizedPath.hasPrefix(scopedDirectory + "/") || standardizedPath == scopedDirectory {
|
|
91
|
+
return [.read, .write]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return []
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@objc
|
|
98
|
+
public func getExternalPathPermissions(_ url: URL) -> EXFileSystemPermissionFlags {
|
|
99
|
+
if self.isScoped && url.path.contains("ExponentExperienceData") {
|
|
100
|
+
return []
|
|
101
|
+
}
|
|
102
|
+
var filePermissions: EXFileSystemPermissionFlags = []
|
|
103
|
+
if FileManager.default.isReadableFile(atPath: url.absoluteString) {
|
|
104
|
+
filePermissions.insert(.read)
|
|
105
|
+
}
|
|
106
|
+
if FileManager.default.isWritableFile(atPath: url.absoluteString) {
|
|
107
|
+
filePermissions.insert(.write)
|
|
108
|
+
}
|
|
109
|
+
return filePermissions
|
|
110
|
+
}
|
|
111
|
+
}
|
package/ios/JSI/EXJSIInstaller.h
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
@class EXAppContext;
|
|
7
7
|
@class EXRuntime;
|
|
8
8
|
|
|
9
|
+
#if __has_include(<ReactCommon/RCTRuntimeExecutor.h>)
|
|
10
|
+
@class RCTRuntimeExecutor;
|
|
11
|
+
#endif // React Native >=0.74
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
Property name of the core object in the global scope of the Expo JS runtime.
|
|
15
|
+
*/
|
|
16
|
+
extern NSString * _Nonnull const EXGlobalCoreObjectPropertyName;
|
|
17
|
+
|
|
9
18
|
@interface EXJavaScriptRuntimeManager : NSObject
|
|
10
19
|
|
|
11
20
|
/**
|
|
@@ -14,10 +23,29 @@
|
|
|
14
23
|
*/
|
|
15
24
|
+ (nullable EXRuntime *)runtimeFromBridge:(nonnull RCTBridge *)bridge NS_SWIFT_NAME(runtime(fromBridge:));
|
|
16
25
|
|
|
26
|
+
#if __has_include(<ReactCommon/RCTRuntimeExecutor.h>)
|
|
27
|
+
+ (nullable EXRuntime *)runtimeFromBridge:(nonnull RCTBridge *)bridge withExecutor:(nonnull RCTRuntimeExecutor *)executor;
|
|
28
|
+
#endif // React Native >=0.74
|
|
29
|
+
|
|
17
30
|
/**
|
|
18
31
|
Installs ExpoModules host object in the runtime of the given app context.
|
|
19
32
|
Returns a bool value whether the installation succeeded.
|
|
20
33
|
*/
|
|
21
34
|
+ (BOOL)installExpoModulesHostObject:(nonnull EXAppContext *)appContext;
|
|
22
35
|
|
|
36
|
+
/**
|
|
37
|
+
Installs the base class for shared objects, i.e. `global.expo.SharedObject`.
|
|
38
|
+
*/
|
|
39
|
+
+ (void)installSharedObjectClass:(nonnull EXRuntime *)runtime releaser:(void(^)(long))releaser;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
Installs the EventEmitter class in the given runtime as `global.expo.EventEmitter`.
|
|
43
|
+
*/
|
|
44
|
+
+ (void)installEventEmitterClass:(nonnull EXRuntime *)runtime;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
Installs the NativeModule class in the given runtime as `global.expo.NativeModule`.
|
|
48
|
+
*/
|
|
49
|
+
+ (void)installNativeModuleClass:(nonnull EXRuntime *)runtime;
|
|
50
|
+
|
|
23
51
|
@end
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
+
#if __has_include(<ReactCommon/RCTRuntimeExecutor.h>)
|
|
4
|
+
#import <ReactCommon/RCTRuntimeExecutor.h>
|
|
5
|
+
#endif // React Native >=0.74
|
|
6
|
+
|
|
3
7
|
#import <ExpoModulesCore/EXJSIInstaller.h>
|
|
4
8
|
#import <ExpoModulesCore/EXJavaScriptRuntime.h>
|
|
5
9
|
#import <ExpoModulesCore/ExpoModulesHostObject.h>
|
|
10
|
+
#import <ExpoModulesCore/BridgelessJSCallInvoker.h>
|
|
6
11
|
#import <ExpoModulesCore/LazyObject.h>
|
|
12
|
+
#import <ExpoModulesCore/SharedObject.h>
|
|
13
|
+
#import <ExpoModulesCore/EventEmitter.h>
|
|
14
|
+
#import <ExpoModulesCore/NativeModule.h>
|
|
7
15
|
#import <ExpoModulesCore/Swift.h>
|
|
8
16
|
|
|
9
17
|
namespace jsi = facebook::jsi;
|
|
10
18
|
|
|
11
19
|
/**
|
|
12
|
-
Property name
|
|
20
|
+
Property name of the core object in the global scope of the Expo JS runtime.
|
|
13
21
|
*/
|
|
14
|
-
|
|
22
|
+
NSString *const EXGlobalCoreObjectPropertyName = @"expo";
|
|
15
23
|
|
|
16
24
|
/**
|
|
17
|
-
Property name used to define the modules host object in the
|
|
25
|
+
Property name used to define the modules host object in the main object of the Expo JS runtime.
|
|
18
26
|
*/
|
|
19
|
-
static NSString *
|
|
27
|
+
static NSString *modulesHostObjectPropertyName = @"modules";
|
|
20
28
|
|
|
21
29
|
@interface RCTBridge (ExpoBridgeWithRuntime)
|
|
22
30
|
|
|
@@ -29,10 +37,31 @@ static NSString *modulesHostObjectLegacyPropertyName = @"ExpoModules";
|
|
|
29
37
|
|
|
30
38
|
+ (nullable EXRuntime *)runtimeFromBridge:(nonnull RCTBridge *)bridge
|
|
31
39
|
{
|
|
32
|
-
jsi::Runtime *jsiRuntime =
|
|
40
|
+
jsi::Runtime *jsiRuntime = reinterpret_cast<jsi::Runtime *>(bridge.runtime);
|
|
33
41
|
return jsiRuntime ? [[EXRuntime alloc] initWithRuntime:jsiRuntime callInvoker:bridge.jsCallInvoker] : nil;
|
|
34
42
|
}
|
|
35
43
|
|
|
44
|
+
#if __has_include(<ReactCommon/RCTRuntimeExecutor.h>)
|
|
45
|
+
+ (nullable EXRuntime *)runtimeFromBridge:(nonnull RCTBridge *)bridge withExecutor:(nonnull RCTRuntimeExecutor *)executor
|
|
46
|
+
{
|
|
47
|
+
jsi::Runtime *jsiRuntime = reinterpret_cast<jsi::Runtime *>(bridge.runtime);
|
|
48
|
+
|
|
49
|
+
// Create a call invoker based on the given runtime executor.
|
|
50
|
+
auto callInvoker = std::make_shared<expo::BridgelessJSCallInvoker>([executor](std::function<void(jsi::Runtime &runtime)> &&callback) {
|
|
51
|
+
// Convert to Objective-C block so it can be captured properly.
|
|
52
|
+
__block auto callbackBlock = callback;
|
|
53
|
+
|
|
54
|
+
[executor execute:^(jsi::Runtime &runtime) {
|
|
55
|
+
callbackBlock(runtime);
|
|
56
|
+
}];
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return jsiRuntime ? [[EXRuntime alloc] initWithRuntime:jsiRuntime callInvoker:callInvoker] : nil;
|
|
60
|
+
}
|
|
61
|
+
#endif // React Native >=0.74
|
|
62
|
+
|
|
63
|
+
#pragma mark - Installing JSI bindings
|
|
64
|
+
|
|
36
65
|
+ (BOOL)installExpoModulesHostObject:(nonnull EXAppContext *)appContext
|
|
37
66
|
{
|
|
38
67
|
EXRuntime *runtime = [appContext _runtime];
|
|
@@ -43,7 +72,9 @@ static NSString *modulesHostObjectLegacyPropertyName = @"ExpoModules";
|
|
|
43
72
|
}
|
|
44
73
|
|
|
45
74
|
EXJavaScriptObject *global = [runtime global];
|
|
46
|
-
|
|
75
|
+
EXJavaScriptValue *coreProperty = [global getProperty:EXGlobalCoreObjectPropertyName];
|
|
76
|
+
NSAssert([coreProperty isObject], @"The global core property should be an object");
|
|
77
|
+
EXJavaScriptObject *coreObject = [coreProperty getObject];
|
|
47
78
|
|
|
48
79
|
if ([coreObject hasProperty:modulesHostObjectPropertyName]) {
|
|
49
80
|
return false;
|
|
@@ -57,11 +88,24 @@ static NSString *modulesHostObjectLegacyPropertyName = @"ExpoModules";
|
|
|
57
88
|
value:modulesHostObject
|
|
58
89
|
options:EXJavaScriptObjectPropertyDescriptorEnumerable];
|
|
59
90
|
|
|
60
|
-
// Also define `global.ExpoModules` for backwards compatibility (used before SDK47, can be removed in SDK48).
|
|
61
|
-
[global defineProperty:modulesHostObjectLegacyPropertyName
|
|
62
|
-
value:modulesHostObject
|
|
63
|
-
options:EXJavaScriptObjectPropertyDescriptorEnumerable];
|
|
64
91
|
return true;
|
|
65
92
|
}
|
|
66
93
|
|
|
94
|
+
+ (void)installSharedObjectClass:(nonnull EXRuntime *)runtime releaser:(void(^)(long))releaser
|
|
95
|
+
{
|
|
96
|
+
expo::SharedObject::installBaseClass(*[runtime get], [releaser](expo::SharedObject::ObjectId objectId) {
|
|
97
|
+
releaser(objectId);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
+ (void)installEventEmitterClass:(nonnull EXRuntime *)runtime
|
|
102
|
+
{
|
|
103
|
+
expo::EventEmitter::installClass(*[runtime get]);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
+ (void)installNativeModuleClass:(nonnull EXRuntime *)runtime
|
|
107
|
+
{
|
|
108
|
+
expo::NativeModule::installClass(*[runtime get]);
|
|
109
|
+
}
|
|
110
|
+
|
|
67
111
|
@end
|
package/ios/JSI/EXJSIUtils.h
CHANGED
|
@@ -20,17 +20,6 @@ using PromiseInvocationBlock = void (^)(RCTPromiseResolveBlock resolveWrapper, R
|
|
|
20
20
|
|
|
21
21
|
void callPromiseSetupWithBlock(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> jsInvoker, std::shared_ptr<react::Promise> promise, PromiseInvocationBlock setupBlock);
|
|
22
22
|
|
|
23
|
-
#pragma mark - Classes
|
|
24
|
-
|
|
25
|
-
using ClassConstructor = std::function<void(jsi::Runtime &runtime, const jsi::Value &thisValue, const jsi::Value *args, size_t count)>;
|
|
26
|
-
|
|
27
|
-
std::shared_ptr<jsi::Function> createClass(jsi::Runtime &runtime, const char *name, ClassConstructor constructor);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
Creates a new object, using the provided object as the prototype.
|
|
31
|
-
*/
|
|
32
|
-
std::shared_ptr<jsi::Object> createObjectWithPrototype(jsi::Runtime &runtime, std::shared_ptr<jsi::Object> prototype);
|
|
33
|
-
|
|
34
23
|
#pragma mark - Weak objects
|
|
35
24
|
|
|
36
25
|
/**
|
|
@@ -60,3 +49,18 @@ jsi::Value makeCodedError(jsi::Runtime &runtime, NSString *code, NSString *messa
|
|
|
60
49
|
} // namespace expo
|
|
61
50
|
|
|
62
51
|
#endif
|
|
52
|
+
|
|
53
|
+
#import <ExpoModulesCore/EXJavaScriptObject.h>
|
|
54
|
+
#import <ExpoModulesCore/EXJavaScriptRuntime.h>
|
|
55
|
+
|
|
56
|
+
NS_SWIFT_NAME(JSIUtils)
|
|
57
|
+
@interface EXJSIUtils : NSObject
|
|
58
|
+
|
|
59
|
+
+ (nonnull EXJavaScriptObject *)createNativeModuleObject:(nonnull EXJavaScriptRuntime *)runtime;
|
|
60
|
+
|
|
61
|
+
+ (void)emitEvent:(nonnull NSString *)eventName
|
|
62
|
+
toObject:(nonnull EXJavaScriptObject *)object
|
|
63
|
+
withArguments:(nonnull NSArray<id> *)arguments
|
|
64
|
+
inRuntime:(nonnull EXJavaScriptRuntime *)runtime;
|
|
65
|
+
|
|
66
|
+
@end
|
package/ios/JSI/EXJSIUtils.mm
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
#import <ExpoModulesCore/EXJSIConversions.h>
|
|
7
7
|
#import <ExpoModulesCore/EXJSIUtils.h>
|
|
8
8
|
#import <ExpoModulesCore/JSIUtils.h>
|
|
9
|
+
#import <ExpoModulesCore/NativeModule.h>
|
|
10
|
+
#import <ExpoModulesCore/EventEmitter.h>
|
|
9
11
|
|
|
10
12
|
namespace expo {
|
|
11
13
|
|
|
@@ -87,55 +89,6 @@ void callPromiseSetupWithBlock(jsi::Runtime &runtime, std::shared_ptr<CallInvoke
|
|
|
87
89
|
setupBlock(resolveBlock, rejectBlock);
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
std::shared_ptr<jsi::Function> createClass(jsi::Runtime &runtime, const char *name, ClassConstructor constructor) {
|
|
91
|
-
std::string nativeConstructorKey("__native_constructor__");
|
|
92
|
-
|
|
93
|
-
// Create a string buffer of the source code to evaluate.
|
|
94
|
-
std::stringstream source;
|
|
95
|
-
source << "(function " << name << "(...args) { this." << nativeConstructorKey << "(...args); return this; })";
|
|
96
|
-
std::shared_ptr<jsi::StringBuffer> sourceBuffer = std::make_shared<jsi::StringBuffer>(source.str());
|
|
97
|
-
|
|
98
|
-
// Evaluate the code and obtain returned value (the constructor function).
|
|
99
|
-
jsi::Object klass = runtime.evaluateJavaScript(sourceBuffer, "").asObject(runtime);
|
|
100
|
-
|
|
101
|
-
// Set the native constructor in the prototype.
|
|
102
|
-
jsi::Object prototype = klass.getPropertyAsObject(runtime, "prototype");
|
|
103
|
-
jsi::PropNameID nativeConstructorPropId = jsi::PropNameID::forAscii(runtime, nativeConstructorKey);
|
|
104
|
-
jsi::Function nativeConstructor = jsi::Function::createFromHostFunction(
|
|
105
|
-
runtime,
|
|
106
|
-
nativeConstructorPropId,
|
|
107
|
-
// The paramCount is not obligatory to match, it only affects the `length` property of the function.
|
|
108
|
-
0,
|
|
109
|
-
[constructor](jsi::Runtime &runtime, const jsi::Value &thisValue, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
110
|
-
constructor(runtime, thisValue, args, count);
|
|
111
|
-
return jsi::Value::undefined();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
jsi::Object descriptor(runtime);
|
|
115
|
-
descriptor.setProperty(runtime, "value", jsi::Value(runtime, nativeConstructor));
|
|
116
|
-
|
|
117
|
-
common::definePropertyOnJSIObject(runtime, &prototype, nativeConstructorKey.c_str(), std::move(descriptor));
|
|
118
|
-
|
|
119
|
-
return std::make_shared<jsi::Function>(klass.asFunction(runtime));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
std::shared_ptr<jsi::Object> createObjectWithPrototype(jsi::Runtime &runtime, std::shared_ptr<jsi::Object> prototype) {
|
|
123
|
-
// Get the "Object" class.
|
|
124
|
-
jsi::Object objectClass = runtime
|
|
125
|
-
.global()
|
|
126
|
-
.getPropertyAsObject(runtime, "Object");
|
|
127
|
-
|
|
128
|
-
// Call "Object.create(prototype)" to create an object with the given prototype without calling the constructor.
|
|
129
|
-
jsi::Object object = objectClass
|
|
130
|
-
.getPropertyAsFunction(runtime, "create")
|
|
131
|
-
.callWithThis(runtime, objectClass, {
|
|
132
|
-
jsi::Value(runtime, *prototype)
|
|
133
|
-
})
|
|
134
|
-
.asObject(runtime);
|
|
135
|
-
|
|
136
|
-
return std::make_shared<jsi::Object>(std::move(object));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
92
|
#pragma mark - Weak objects
|
|
140
93
|
|
|
141
94
|
bool isWeakRefSupported(jsi::Runtime &runtime) {
|
|
@@ -183,3 +136,22 @@ jsi::Value makeCodedError(jsi::Runtime &runtime, NSString *code, NSString *messa
|
|
|
183
136
|
}
|
|
184
137
|
|
|
185
138
|
} // namespace expo
|
|
139
|
+
|
|
140
|
+
@implementation EXJSIUtils
|
|
141
|
+
|
|
142
|
+
+ (nonnull EXJavaScriptObject *)createNativeModuleObject:(nonnull EXJavaScriptRuntime *)runtime
|
|
143
|
+
{
|
|
144
|
+
std::shared_ptr<jsi::Object> nativeModule = std::make_shared<jsi::Object>(expo::NativeModule::createInstance(*[runtime get]));
|
|
145
|
+
return [[EXJavaScriptObject alloc] initWith:nativeModule runtime:runtime];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
+ (void)emitEvent:(nonnull NSString *)eventName
|
|
149
|
+
toObject:(nonnull EXJavaScriptObject *)object
|
|
150
|
+
withArguments:(nonnull NSArray<id> *)arguments
|
|
151
|
+
inRuntime:(nonnull EXJavaScriptRuntime *)runtime
|
|
152
|
+
{
|
|
153
|
+
const std::vector<jsi::Value> argumentsVector(expo::convertNSArrayToStdVector(*[runtime get], arguments));
|
|
154
|
+
expo::EventEmitter::emitEvent(*[runtime get], *[object get], [eventName UTF8String], std::move(argumentsVector));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@end
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
jsi::Runtime *runtime = [_runtime get];
|
|
77
77
|
jsi::Object *jsThis = _jsObjectPtr.get();
|
|
78
78
|
|
|
79
|
-
expo::common::
|
|
79
|
+
expo::common::defineProperty(*runtime, jsThis, [name UTF8String], std::move(*[descriptor get]));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
- (void)defineProperty:(nonnull NSString *)name value:(nullable id)value options:(EXJavaScriptObjectPropertyDescriptor)options
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
jsi::Object descriptor = [self preparePropertyDescriptorWithOptions:options];
|
|
88
88
|
descriptor.setProperty(*runtime, "value", expo::convertObjCObjectToJSIValue(*runtime, value));
|
|
89
89
|
|
|
90
|
-
expo::common::
|
|
90
|
+
expo::common::defineProperty(*runtime, jsThis, [name UTF8String], std::move(descriptor));
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
#pragma mark - WeakObject
|
|
@@ -14,6 +14,9 @@ namespace react = facebook::react;
|
|
|
14
14
|
|
|
15
15
|
@class EXJavaScriptValue;
|
|
16
16
|
@class EXJavaScriptObject;
|
|
17
|
+
@class EXJavaScriptSharedObject;
|
|
18
|
+
|
|
19
|
+
typedef void (^JSRuntimeExecutionBlock)();
|
|
17
20
|
|
|
18
21
|
typedef void (^JSAsyncFunctionBlock)(EXJavaScriptValue * _Nonnull thisValue,
|
|
19
22
|
NSArray<EXJavaScriptValue *> * _Nonnull arguments,
|
|
@@ -102,6 +105,11 @@ typedef void (^ClassConstructorBlock)(EXJavaScriptObject * _Nonnull thisValue, N
|
|
|
102
105
|
*/
|
|
103
106
|
- (nullable EXJavaScriptObject *)createObjectWithPrototype:(nonnull EXJavaScriptObject *)prototype;
|
|
104
107
|
|
|
108
|
+
#pragma mark - Shared objects
|
|
109
|
+
|
|
110
|
+
- (nonnull EXJavaScriptObject *)createSharedObjectClass:(nonnull NSString *)name
|
|
111
|
+
constructor:(nonnull ClassConstructorBlock)constructor;
|
|
112
|
+
|
|
105
113
|
#pragma mark - Script evaluation
|
|
106
114
|
|
|
107
115
|
/**
|
|
@@ -109,4 +117,11 @@ typedef void (^ClassConstructorBlock)(EXJavaScriptObject * _Nonnull thisValue, N
|
|
|
109
117
|
*/
|
|
110
118
|
- (nonnull EXJavaScriptValue *)evaluateScript:(nonnull NSString *)scriptSource NS_REFINED_FOR_SWIFT;
|
|
111
119
|
|
|
120
|
+
#pragma mark - Runtime execution
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
Schedules a block to be executed with granted synchronized access to the JS runtime.
|
|
124
|
+
*/
|
|
125
|
+
- (void)schedule:(nonnull JSRuntimeExecutionBlock)block priority:(int)priority NS_REFINED_FOR_SWIFT;
|
|
126
|
+
|
|
112
127
|
@end
|
|
@@ -18,28 +18,9 @@
|
|
|
18
18
|
#import <ExpoModulesCore/ExpoModulesHostObject.h>
|
|
19
19
|
#import <ExpoModulesCore/EXJSIUtils.h>
|
|
20
20
|
#import <ExpoModulesCore/EXJSIConversions.h>
|
|
21
|
+
#import <ExpoModulesCore/SharedObject.h>
|
|
21
22
|
#import <ExpoModulesCore/Swift.h>
|
|
22
|
-
|
|
23
|
-
namespace {
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Dummy CallInvoker that invokes everything immediately.
|
|
27
|
-
* Used in the test environment to check the async flow.
|
|
28
|
-
*/
|
|
29
|
-
class SyncCallInvoker : public react::CallInvoker {
|
|
30
|
-
public:
|
|
31
|
-
void invokeAsync(std::function<void()> &&func) override {
|
|
32
|
-
func();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
void invokeSync(std::function<void()> &&func) override {
|
|
36
|
-
func();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
~SyncCallInvoker() override = default;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
} // namespace
|
|
23
|
+
#import <ExpoModulesCore/TestingSyncJSCallInvoker.h>
|
|
43
24
|
|
|
44
25
|
@implementation EXJavaScriptRuntime {
|
|
45
26
|
std::shared_ptr<jsi::Runtime> _runtime;
|
|
@@ -70,7 +51,7 @@ public:
|
|
|
70
51
|
#else
|
|
71
52
|
_runtime = jsc::makeJSCRuntime();
|
|
72
53
|
#endif
|
|
73
|
-
_jsCallInvoker = std::make_shared<
|
|
54
|
+
_jsCallInvoker = std::make_shared<expo::TestingSyncJSCallInvoker>(_runtime);
|
|
74
55
|
}
|
|
75
56
|
return self;
|
|
76
57
|
}
|
|
@@ -131,7 +112,20 @@ public:
|
|
|
131
112
|
if (error == nil) {
|
|
132
113
|
return expo::convertObjCObjectToJSIValue(runtime, result);
|
|
133
114
|
} else {
|
|
134
|
-
|
|
115
|
+
// `expo::makeCodedError` doesn't work during unit tests, so we construct Error and add a code,
|
|
116
|
+
// instead of using the CodedError subclass.
|
|
117
|
+
jsi::String jsCode = expo::convertNSStringToJSIString(runtime, error.userInfo[@"code"]);
|
|
118
|
+
jsi::String jsMessage = expo::convertNSStringToJSIString(runtime, error.userInfo[@"message"]);
|
|
119
|
+
jsi::Value error = runtime
|
|
120
|
+
.global()
|
|
121
|
+
.getProperty(runtime, "Error")
|
|
122
|
+
.asObject(runtime)
|
|
123
|
+
.asFunction(runtime)
|
|
124
|
+
.callAsConstructor(runtime, {
|
|
125
|
+
jsi::Value(runtime, jsMessage)
|
|
126
|
+
});
|
|
127
|
+
error.asObject(runtime).setProperty(runtime, "code", jsi::Value(runtime, jsCode));
|
|
128
|
+
throw jsi::JSError(runtime, jsi::Value(runtime, error));
|
|
135
129
|
}
|
|
136
130
|
};
|
|
137
131
|
return [self createHostFunction:name argsCount:argsCount block:hostFunctionBlock];
|
|
@@ -167,23 +161,43 @@ public:
|
|
|
167
161
|
- (nonnull EXJavaScriptObject *)createClass:(nonnull NSString *)name
|
|
168
162
|
constructor:(nonnull ClassConstructorBlock)constructor
|
|
169
163
|
{
|
|
170
|
-
expo::ClassConstructor jsConstructor = [self, constructor](jsi::Runtime &runtime, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
|
164
|
+
expo::common::ClassConstructor jsConstructor = [self, constructor](jsi::Runtime &runtime, const jsi::Value &thisValue, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
171
165
|
std::shared_ptr<jsi::Object> thisPtr = std::make_shared<jsi::Object>(thisValue.asObject(runtime));
|
|
172
166
|
EXJavaScriptObject *caller = [[EXJavaScriptObject alloc] initWith:thisPtr runtime:self];
|
|
173
167
|
NSArray<EXJavaScriptValue *> *arguments = expo::convertJSIValuesToNSArray(self, args, count);
|
|
174
168
|
|
|
169
|
+
// Returning something else than `this` is not supported in native constructors.
|
|
175
170
|
constructor(caller, arguments);
|
|
171
|
+
|
|
172
|
+
return jsi::Value(runtime, thisValue);
|
|
176
173
|
};
|
|
177
|
-
std::shared_ptr<jsi::Function> klass = expo::createClass(*_runtime, [name UTF8String], jsConstructor);
|
|
174
|
+
std::shared_ptr<jsi::Function> klass = std::make_shared<jsi::Function>(expo::common::createClass(*_runtime, [name UTF8String], jsConstructor));
|
|
178
175
|
return [[EXJavaScriptObject alloc] initWith:klass runtime:self];
|
|
179
176
|
}
|
|
180
177
|
|
|
181
178
|
- (nullable EXJavaScriptObject *)createObjectWithPrototype:(nonnull EXJavaScriptObject *)prototype
|
|
182
179
|
{
|
|
183
|
-
std::shared_ptr<jsi::Object> object = expo::createObjectWithPrototype(*_runtime, [prototype getShared]);
|
|
180
|
+
std::shared_ptr<jsi::Object> object = std::make_shared<jsi::Object>(expo::common::createObjectWithPrototype(*_runtime, [prototype getShared].get()));
|
|
184
181
|
return object ? [[EXJavaScriptObject alloc] initWith:object runtime:self] : nil;
|
|
185
182
|
}
|
|
186
183
|
|
|
184
|
+
#pragma mark - Shared objects
|
|
185
|
+
|
|
186
|
+
- (nonnull EXJavaScriptObject *)createSharedObjectClass:(nonnull NSString *)name
|
|
187
|
+
constructor:(nonnull ClassConstructorBlock)constructor
|
|
188
|
+
{
|
|
189
|
+
expo::common::ClassConstructor jsConstructor = [self, constructor](jsi::Runtime &runtime, const jsi::Value &thisValue, const jsi::Value *args, size_t count) {
|
|
190
|
+
std::shared_ptr<jsi::Object> thisPtr = std::make_shared<jsi::Object>(thisValue.asObject(runtime));
|
|
191
|
+
EXJavaScriptObject *caller = [[EXJavaScriptObject alloc] initWith:thisPtr runtime:self];
|
|
192
|
+
NSArray<EXJavaScriptValue *> *arguments = expo::convertJSIValuesToNSArray(self, args, count);
|
|
193
|
+
|
|
194
|
+
constructor(caller, arguments);
|
|
195
|
+
return jsi::Value(runtime, thisValue);
|
|
196
|
+
};
|
|
197
|
+
std::shared_ptr<jsi::Function> klass = std::make_shared<jsi::Function>(expo::SharedObject::createClass(*_runtime, [name UTF8String], jsConstructor));
|
|
198
|
+
return [[EXJavaScriptObject alloc] initWith:klass runtime:self];
|
|
199
|
+
}
|
|
200
|
+
|
|
187
201
|
#pragma mark - Script evaluation
|
|
188
202
|
|
|
189
203
|
- (nonnull EXJavaScriptValue *)evaluateScript:(nonnull NSString *)scriptSource
|
|
@@ -211,6 +225,19 @@ public:
|
|
|
211
225
|
return [[EXJavaScriptValue alloc] initWithRuntime:self value:result];
|
|
212
226
|
}
|
|
213
227
|
|
|
228
|
+
#pragma mark - Runtime execution
|
|
229
|
+
|
|
230
|
+
- (void)schedule:(nonnull JSRuntimeExecutionBlock)block priority:(int)priority
|
|
231
|
+
{
|
|
232
|
+
#if REACT_NATIVE_TARGET_VERSION >= 75
|
|
233
|
+
_jsCallInvoker->invokeAsync(SchedulerPriority(priority), [block = std::move(block)](jsi::Runtime&) {
|
|
234
|
+
block();
|
|
235
|
+
});
|
|
236
|
+
#else
|
|
237
|
+
_jsCallInvoker->invokeAsync(SchedulerPriority(priority), block);
|
|
238
|
+
#endif
|
|
239
|
+
}
|
|
240
|
+
|
|
214
241
|
#pragma mark - Private
|
|
215
242
|
|
|
216
243
|
- (nonnull EXJavaScriptObject *)createHostFunction:(nonnull NSString *)name
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2024-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#import <ExpoModulesCore/EXJavaScriptObject.h>
|
|
4
|
+
|
|
5
|
+
typedef void (^ObjectReleaser)(long objectId);
|
|
6
|
+
|
|
7
|
+
NS_SWIFT_NAME(SharedObjectUtils)
|
|
8
|
+
@interface EXSharedObjectUtils : NSObject
|
|
9
|
+
|
|
10
|
+
+ (void)setNativeState:(nonnull EXJavaScriptObject *)object
|
|
11
|
+
runtime:(nonnull EXJavaScriptRuntime *)runtime
|
|
12
|
+
objectId:(long)objectId
|
|
13
|
+
releaser:(nonnull ObjectReleaser)releaser;
|
|
14
|
+
|
|
15
|
+
@end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright 2024-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#import <ExpoModulesCore/EXJavaScriptRuntime.h>
|
|
4
|
+
#import <ExpoModulesCore/EXSharedObjectUtils.h>
|
|
5
|
+
#import <ExpoModulesCore/SharedObject.h>
|
|
6
|
+
|
|
7
|
+
@implementation EXSharedObjectUtils
|
|
8
|
+
|
|
9
|
+
+ (void)setNativeState:(nonnull EXJavaScriptObject *)object
|
|
10
|
+
runtime:(nonnull EXJavaScriptRuntime *)runtime
|
|
11
|
+
objectId:(long)objectId
|
|
12
|
+
releaser:(nonnull ObjectReleaser)releaser
|
|
13
|
+
{
|
|
14
|
+
auto nativeState = std::make_shared<expo::SharedObject::NativeState>(objectId, releaser);
|
|
15
|
+
[object get]->setNativeState(*[runtime get], nativeState);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@end
|
|
@@ -60,6 +60,22 @@ public extension JavaScriptRuntime {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
Schedules a block to be executed with granted synchronized access to the JS runtime.
|
|
66
|
+
*/
|
|
67
|
+
public func schedule(priority: SchedulerPriority = .normal, _ closure: @escaping () -> Void) {
|
|
68
|
+
__schedule(closure, priority: priority.rawValue)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Keep it in sync with the equivalent C++ enum from React Native (see SchedulerPriority.h from React-callinvoker).
|
|
73
|
+
public enum SchedulerPriority: Int32 {
|
|
74
|
+
case immediate = 1
|
|
75
|
+
case userBlocking = 2
|
|
76
|
+
case normal = 3
|
|
77
|
+
case low = 4
|
|
78
|
+
case idle = 5
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
internal final class JavaScriptEvalException: GenericException<NSError> {
|