expo-modules-core 0.9.2 → 0.11.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 +33 -3
- package/README.md +3 -3
- package/android/CMakeLists.txt +163 -0
- package/android/build.gradle +343 -5
- package/android/src/main/cpp/CachedReferencesRegistry.cpp +65 -0
- package/android/src/main/cpp/CachedReferencesRegistry.h +80 -0
- package/android/src/main/cpp/Exceptions.cpp +22 -0
- package/android/src/main/cpp/Exceptions.h +38 -0
- package/android/src/main/cpp/ExpoModulesHostObject.cpp +47 -0
- package/android/src/main/cpp/ExpoModulesHostObject.h +32 -0
- package/android/src/main/cpp/JNIFunctionBody.cpp +44 -0
- package/android/src/main/cpp/JNIFunctionBody.h +50 -0
- package/android/src/main/cpp/JNIInjector.cpp +23 -0
- package/android/src/main/cpp/JSIInteropModuleRegistry.cpp +122 -0
- package/android/src/main/cpp/JSIInteropModuleRegistry.h +96 -0
- package/android/src/main/cpp/JSIObjectWrapper.h +33 -0
- package/android/src/main/cpp/JSITypeConverter.h +84 -0
- package/android/src/main/cpp/JavaScriptModuleObject.cpp +219 -0
- package/android/src/main/cpp/JavaScriptModuleObject.h +144 -0
- package/android/src/main/cpp/JavaScriptObject.cpp +125 -0
- package/android/src/main/cpp/JavaScriptObject.h +131 -0
- package/android/src/main/cpp/JavaScriptRuntime.cpp +127 -0
- package/android/src/main/cpp/JavaScriptRuntime.h +87 -0
- package/android/src/main/cpp/JavaScriptValue.cpp +172 -0
- package/android/src/main/cpp/JavaScriptValue.h +78 -0
- package/android/src/main/cpp/MethodMetadata.cpp +340 -0
- package/android/src/main/cpp/MethodMetadata.h +131 -0
- package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +2 -0
- package/android/src/main/java/expo/modules/core/errors/ContextDestroyedException.kt +7 -0
- package/android/src/main/java/expo/modules/interfaces/permissions/Permissions.java +30 -0
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +98 -3
- package/android/src/main/java/expo/modules/kotlin/ConcatIterator.kt +18 -0
- package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +15 -12
- package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +45 -3
- package/android/src/main/java/expo/modules/kotlin/activityaware/AppCompatActivityAware.kt +49 -0
- package/android/src/main/java/expo/modules/kotlin/activityaware/AppCompatActivityAwareHelper.kt +43 -0
- package/android/src/main/java/expo/modules/kotlin/activityaware/OnActivityAvailableListener.kt +18 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/ActivityResultsManager.kt +99 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultCaller.kt +25 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultContract.kt +27 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultFallbackCallback.kt +17 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultLauncher.kt +30 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt +358 -0
- package/android/src/main/java/expo/modules/kotlin/activityresult/DataPersistor.kt +135 -0
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +13 -0
- package/android/src/main/java/expo/modules/kotlin/exception/ExceptionDecorator.kt +2 -0
- package/android/src/main/java/expo/modules/kotlin/functions/AnyFunction.kt +53 -15
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunction.kt +35 -7
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +13 -121
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionComponent.kt +21 -0
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromiseComponent.kt +21 -0
- package/android/src/main/java/expo/modules/kotlin/functions/SuspendFunctionComponent.kt +63 -0
- package/android/src/main/java/expo/modules/kotlin/functions/SyncFunctionComponent.kt +36 -0
- package/android/src/main/java/expo/modules/kotlin/jni/CppType.kt +19 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JNIFunctionBody.kt +39 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JSIInteropModuleRegistry.kt +89 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptModuleObject.kt +46 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptObject.kt +113 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptValue.kt +35 -0
- package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +16 -6
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +5 -500
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionData.kt +30 -5
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +271 -0
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionData.kt +21 -0
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponent.kt +54 -0
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponentBuilder.kt +32 -0
- package/android/src/main/java/expo/modules/kotlin/providers/AppContextProvider.kt +14 -0
- package/android/src/main/java/expo/modules/kotlin/providers/CurrentActivityProvider.kt +22 -0
- package/android/src/main/java/expo/modules/kotlin/records/RecordTypeConverter.kt +19 -2
- package/android/src/main/java/expo/modules/kotlin/types/AnyType.kt +3 -2
- package/android/src/main/java/expo/modules/kotlin/types/AnyTypeConverter.kt +36 -0
- package/android/src/main/java/expo/modules/kotlin/types/ArrayTypeConverter.kt +7 -2
- package/android/src/main/java/expo/modules/kotlin/types/BasicTypeConverters.kt +68 -20
- package/android/src/main/java/expo/modules/kotlin/types/EnumTypeConverter.kt +50 -22
- package/android/src/main/java/expo/modules/kotlin/types/ListTypeConverter.kt +18 -2
- package/android/src/main/java/expo/modules/kotlin/types/MapTypeConverter.kt +18 -2
- package/android/src/main/java/expo/modules/kotlin/types/PairTypeConverter.kt +17 -2
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +43 -3
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +12 -0
- package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinitionBuilder.kt +0 -41
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +0 -33
- package/build/NativeModulesProxy.native.d.ts.map +1 -1
- package/build/NativeModulesProxy.native.js +9 -3
- package/build/NativeModulesProxy.native.js.map +1 -1
- package/build/PermissionsInterface.d.ts +29 -0
- package/build/PermissionsInterface.d.ts.map +1 -1
- package/build/PermissionsInterface.js +9 -0
- package/build/PermissionsInterface.js.map +1 -1
- package/ios/AppDelegates/EXAppDelegatesLoader.m +1 -2
- package/ios/ExpoModulesCore.podspec +3 -2
- package/ios/JSI/EXJSIConversions.mm +6 -0
- package/ios/JSI/EXJSIInstaller.h +15 -21
- package/ios/JSI/EXJSIInstaller.mm +39 -3
- package/ios/JSI/EXJSIUtils.h +48 -3
- package/ios/JSI/EXJSIUtils.mm +88 -4
- package/ios/JSI/EXJavaScriptObject.h +11 -18
- package/ios/JSI/EXJavaScriptObject.mm +37 -18
- package/ios/JSI/EXJavaScriptRuntime.h +43 -9
- package/ios/JSI/EXJavaScriptRuntime.mm +70 -27
- package/ios/JSI/EXJavaScriptTypedArray.h +30 -0
- package/ios/JSI/EXJavaScriptTypedArray.mm +29 -0
- package/ios/JSI/EXJavaScriptValue.h +3 -2
- package/ios/JSI/EXJavaScriptValue.mm +17 -20
- package/ios/JSI/EXJavaScriptWeakObject.h +23 -0
- package/ios/JSI/EXJavaScriptWeakObject.mm +53 -0
- package/ios/JSI/EXObjectDeallocator.h +27 -0
- package/ios/JSI/ExpoModulesHostObject.h +3 -3
- package/ios/JSI/ExpoModulesHostObject.mm +4 -4
- package/ios/JSI/JavaScriptRuntime.swift +38 -1
- package/ios/JSI/JavaScriptValue.swift +7 -0
- package/ios/JSI/TypedArray.cpp +67 -0
- package/ios/JSI/TypedArray.h +46 -0
- package/ios/ModuleRegistryAdapter/EXModuleRegistryAdapter.m +0 -11
- package/ios/NativeModulesProxy/EXNativeModulesProxy.h +17 -10
- package/ios/NativeModulesProxy/EXNativeModulesProxy.mm +86 -77
- package/ios/NativeModulesProxy/NativeModulesProxyModule.swift +17 -0
- package/ios/Services/EXReactNativeEventEmitter.h +2 -2
- package/ios/Services/EXReactNativeEventEmitter.m +11 -6
- package/ios/Swift/AppContext.swift +206 -28
- package/ios/Swift/Arguments/AnyArgument.swift +18 -0
- package/ios/Swift/Arguments/{Types/EnumArgumentType.swift → EnumArgument.swift} +2 -17
- package/ios/Swift/Classes/ClassComponent.swift +95 -0
- package/ios/Swift/Classes/ClassComponentElement.swift +33 -0
- package/ios/Swift/Classes/ClassComponentElementsBuilder.swift +34 -0
- package/ios/Swift/Classes/ClassComponentFactories.swift +96 -0
- package/ios/Swift/DynamicTypes/AnyDynamicType.swift +44 -0
- package/ios/Swift/DynamicTypes/DynamicArrayType.swift +56 -0
- package/ios/Swift/DynamicTypes/DynamicConvertibleType.swift +27 -0
- package/ios/Swift/DynamicTypes/DynamicEnumType.swift +27 -0
- package/ios/Swift/DynamicTypes/DynamicOptionalType.swift +63 -0
- package/ios/Swift/DynamicTypes/DynamicRawType.swift +33 -0
- package/ios/Swift/DynamicTypes/DynamicSharedObjectType.swift +37 -0
- package/ios/Swift/DynamicTypes/DynamicType.swift +39 -0
- package/ios/Swift/DynamicTypes/DynamicTypedArrayType.swift +46 -0
- package/ios/Swift/Exceptions/ChainableException.swift +3 -3
- package/ios/Swift/Exceptions/CodedError.swift +1 -1
- package/ios/Swift/Exceptions/Exception.swift +8 -6
- package/ios/Swift/Exceptions/UnexpectedException.swift +2 -1
- package/ios/Swift/ExpoBridgeModule.m +5 -0
- package/ios/Swift/ExpoBridgeModule.swift +79 -0
- package/ios/Swift/Functions/AnyFunction.swift +33 -31
- package/ios/Swift/Functions/AsyncFunctionComponent.swift +196 -59
- package/ios/Swift/Functions/SyncFunctionComponent.swift +142 -58
- package/ios/Swift/JavaScriptUtils.swift +32 -57
- package/ios/Swift/Logging/LogHandlers.swift +39 -0
- package/ios/Swift/Logging/LogType.swift +62 -0
- package/ios/Swift/Logging/Logger.swift +201 -0
- package/ios/Swift/ModuleHolder.swift +19 -54
- package/ios/Swift/ModuleRegistry.swift +7 -1
- package/ios/Swift/Modules/AnyModule.swift +3 -3
- package/ios/Swift/ModulesProvider.swift +2 -0
- package/ios/Swift/Objects/JavaScriptObjectBuilder.swift +37 -0
- package/ios/Swift/Objects/ObjectDefinition.swift +74 -1
- package/ios/Swift/Objects/ObjectDefinitionComponents.swift +77 -68
- package/ios/Swift/Objects/PropertyComponent.swift +147 -0
- package/ios/Swift/Promise.swift +17 -4
- package/ios/Swift/Records/Field.swift +2 -2
- package/ios/Swift/SharedObjects/SharedObject.swift +20 -0
- package/ios/Swift/SharedObjects/SharedObjectRegistry.swift +129 -0
- package/ios/Swift/TypedArrays/AnyTypedArray.swift +11 -0
- package/ios/Swift/TypedArrays/ConcreteTypedArrays.swift +56 -0
- package/ios/Swift/TypedArrays/GenericTypedArray.swift +49 -0
- package/ios/Swift/TypedArrays/TypedArray.swift +80 -0
- package/ios/Swift/Utilities.swift +28 -0
- package/ios/Swift/Views/ConcreteViewProp.swift +3 -3
- package/ios/Swift/Views/ViewManagerDefinitionComponents.swift +2 -2
- package/ios/Tests/ClassComponentSpec.swift +210 -0
- package/ios/Tests/DynamicTypeSpec.swift +336 -0
- package/ios/Tests/EnumArgumentSpec.swift +48 -0
- package/ios/Tests/ExpoModulesSpec.swift +17 -3
- package/ios/Tests/FunctionSpec.swift +167 -118
- package/ios/Tests/Mocks/ModuleMocks.swift +1 -1
- package/ios/Tests/PropertyComponentSpec.swift +95 -0
- package/ios/Tests/SharedObjectRegistrySpec.swift +109 -0
- package/ios/Tests/TypedArraysSpec.swift +136 -0
- package/package.json +2 -2
- package/src/NativeModulesProxy.native.ts +13 -3
- package/src/PermissionsInterface.ts +29 -0
- package/src/ts-declarations/ExpoModules.d.ts +7 -0
- package/tsconfig.json +1 -1
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromise.kt +0 -15
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncSuspendFunction.kt +0 -36
- package/ios/Swift/Arguments/AnyArgumentType.swift +0 -13
- package/ios/Swift/Arguments/ArgumentType.swift +0 -28
- package/ios/Swift/Arguments/Types/ArrayArgumentType.swift +0 -42
- package/ios/Swift/Arguments/Types/ConvertibleArgumentType.swift +0 -16
- package/ios/Swift/Arguments/Types/OptionalArgumentType.swift +0 -49
- package/ios/Swift/Arguments/Types/PromiseArgumentType.swift +0 -15
- package/ios/Swift/Arguments/Types/RawArgumentType.swift +0 -25
- package/ios/Swift/Functions/ConcreteFunction.swift +0 -103
- package/ios/Swift/SwiftInteropBridge.swift +0 -155
- package/ios/Tests/ArgumentTypeSpec.swift +0 -143
|
@@ -3,24 +3,34 @@ package expo.modules.kotlin.modules
|
|
|
3
3
|
import android.os.Bundle
|
|
4
4
|
import expo.modules.core.errors.ModuleDestroyedException
|
|
5
5
|
import expo.modules.kotlin.AppContext
|
|
6
|
+
import expo.modules.kotlin.providers.AppContextProvider
|
|
6
7
|
import kotlinx.coroutines.CoroutineScope
|
|
7
8
|
import kotlinx.coroutines.cancel
|
|
8
9
|
|
|
9
|
-
abstract class Module {
|
|
10
|
+
abstract class Module : AppContextProvider {
|
|
11
|
+
|
|
12
|
+
// region AppContextProvider
|
|
13
|
+
|
|
10
14
|
@Suppress("PropertyName")
|
|
11
15
|
internal var _appContext: AppContext? = null
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
val appContext: AppContext
|
|
17
|
+
override val appContext: AppContext
|
|
16
18
|
get() = requireNotNull(_appContext) { "The module wasn't created! You can't access the app context." }
|
|
17
19
|
|
|
20
|
+
// endregion
|
|
21
|
+
|
|
22
|
+
private val moduleEventEmitter by lazy { appContext.eventEmitter(this) }
|
|
23
|
+
|
|
18
24
|
@Suppress("PropertyName")
|
|
19
25
|
@PublishedApi
|
|
20
26
|
internal lateinit var coroutineScopeDelegate: Lazy<CoroutineScope>
|
|
21
27
|
val coroutineScope get() = coroutineScopeDelegate.value
|
|
22
28
|
|
|
23
|
-
fun sendEvent(name: String, body: Bundle?) {
|
|
29
|
+
fun sendEvent(name: String, body: Bundle? = Bundle.EMPTY) {
|
|
30
|
+
moduleEventEmitter?.emit(name, body)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fun sendEvent(name: String, body: Map<String, Any?>?) {
|
|
24
34
|
moduleEventEmitter?.emit(name, body)
|
|
25
35
|
}
|
|
26
36
|
|
|
@@ -35,5 +45,5 @@ abstract class Module {
|
|
|
35
45
|
|
|
36
46
|
@Suppress("FunctionName")
|
|
37
47
|
inline fun Module.ModuleDefinition(block: ModuleDefinitionBuilder.() -> Unit): ModuleDefinitionData {
|
|
38
|
-
return ModuleDefinitionBuilder(this).also(block).
|
|
48
|
+
return ModuleDefinitionBuilder(this).also(block).buildModule()
|
|
39
49
|
}
|
|
@@ -1,47 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* We used a function from the experimental STD API - typeOf (see kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/type-of.html).
|
|
3
|
-
* We shouldn't have any problem with that function, cause it's widely used in other libraries created by JetBrains like kotlinx-serializer.
|
|
4
|
-
* This function is super handy if we want to receive a collection type.
|
|
5
|
-
* For example, it's very hard to obtain the generic parameter type from the list class.
|
|
6
|
-
* In plain Java, it's almost impossible. There is a trick to getting such information using something called TypeToken.
|
|
7
|
-
* For instance, the Gson library uses this workaround. But there still will be a problem with nullability.
|
|
8
|
-
* We didn't find a good solution to distinguish between List<Any?> and List<Any>.
|
|
9
|
-
* Mainly because from the JVM perspective it's the same type.
|
|
10
|
-
* That's why we used typeOf. It solves all problems described above.
|
|
11
|
-
*/
|
|
12
|
-
@file:OptIn(ExperimentalStdlibApi::class)
|
|
13
1
|
@file:Suppress("FunctionName")
|
|
14
2
|
|
|
15
3
|
package expo.modules.kotlin.modules
|
|
16
4
|
|
|
17
5
|
import android.app.Activity
|
|
18
6
|
import android.content.Intent
|
|
19
|
-
import expo.modules.kotlin.Promise
|
|
20
7
|
import expo.modules.kotlin.events.BasicEventListener
|
|
21
8
|
import expo.modules.kotlin.events.EventListener
|
|
22
9
|
import expo.modules.kotlin.events.EventListenerWithPayload
|
|
23
10
|
import expo.modules.kotlin.events.EventListenerWithSenderAndPayload
|
|
24
11
|
import expo.modules.kotlin.events.EventName
|
|
25
|
-
import expo.modules.kotlin.events.EventsDefinition
|
|
26
12
|
import expo.modules.kotlin.events.OnActivityResultPayload
|
|
27
|
-
import expo.modules.kotlin.
|
|
28
|
-
import expo.modules.kotlin.functions.AsyncFunction
|
|
29
|
-
import expo.modules.kotlin.functions.AsyncFunctionWithPromise
|
|
30
|
-
import expo.modules.kotlin.functions.AsyncFunctionBuilder
|
|
31
|
-
import expo.modules.kotlin.types.toAnyType
|
|
13
|
+
import expo.modules.kotlin.objects.ObjectDefinitionBuilder
|
|
32
14
|
import expo.modules.kotlin.views.ViewManagerDefinition
|
|
33
15
|
import expo.modules.kotlin.views.ViewManagerDefinitionBuilder
|
|
34
|
-
import kotlin.reflect.typeOf
|
|
35
16
|
|
|
36
17
|
@DefinitionMarker
|
|
37
|
-
class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null) {
|
|
18
|
+
class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null) : ObjectDefinitionBuilder() {
|
|
38
19
|
private var name: String? = null
|
|
39
|
-
private var constantsProvider = { emptyMap<String, Any?>() }
|
|
40
|
-
private var eventsDefinition: EventsDefinition? = null
|
|
41
|
-
private var functionBuilders = mutableListOf<AsyncFunctionBuilder>()
|
|
42
|
-
|
|
43
|
-
@PublishedApi
|
|
44
|
-
internal var methods = mutableMapOf<String, AnyFunction>()
|
|
45
20
|
|
|
46
21
|
@PublishedApi
|
|
47
22
|
internal var viewManagerDefinition: ViewManagerDefinition? = null
|
|
@@ -49,25 +24,17 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
49
24
|
@PublishedApi
|
|
50
25
|
internal val eventListeners = mutableMapOf<EventName, EventListener>()
|
|
51
26
|
|
|
52
|
-
fun
|
|
27
|
+
fun buildModule(): ModuleDefinitionData {
|
|
53
28
|
val moduleName = name ?: module?.javaClass?.simpleName
|
|
54
29
|
|
|
55
30
|
return ModuleDefinitionData(
|
|
56
31
|
requireNotNull(moduleName),
|
|
57
|
-
|
|
58
|
-
methods + functionBuilders.associate { it.build() },
|
|
32
|
+
buildObject(),
|
|
59
33
|
viewManagerDefinition,
|
|
60
|
-
eventListeners
|
|
61
|
-
eventsDefinition
|
|
34
|
+
eventListeners
|
|
62
35
|
)
|
|
63
36
|
}
|
|
64
37
|
|
|
65
|
-
@Deprecated(
|
|
66
|
-
message = "The 'name' component was renamed to 'Name'.",
|
|
67
|
-
replaceWith = ReplaceWith("Name(name)")
|
|
68
|
-
)
|
|
69
|
-
fun name(name: String) = Name(name)
|
|
70
|
-
|
|
71
38
|
/**
|
|
72
39
|
* Sets the name of the module that is exported to the JavaScript world.
|
|
73
40
|
*/
|
|
@@ -75,387 +42,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
75
42
|
this.name = name
|
|
76
43
|
}
|
|
77
44
|
|
|
78
|
-
@Deprecated(
|
|
79
|
-
message = "The 'constants' component was renamed to 'Constants'.",
|
|
80
|
-
replaceWith = ReplaceWith("Constants(constantsProvider)")
|
|
81
|
-
)
|
|
82
|
-
fun constants(constantsProvider: () -> Map<String, Any?>) = Constants(constantsProvider)
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Definition function setting the module's constants to export.
|
|
86
|
-
*/
|
|
87
|
-
fun Constants(constantsProvider: () -> Map<String, Any?>) {
|
|
88
|
-
this.constantsProvider = constantsProvider
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@Deprecated(
|
|
92
|
-
message = "The 'constants' component was renamed to 'Constants'.",
|
|
93
|
-
replaceWith = ReplaceWith("Constants(constants)")
|
|
94
|
-
)
|
|
95
|
-
fun constants(vararg constants: Pair<String, Any?>) = Constants(*constants)
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Definition of the module's constants to export.
|
|
99
|
-
*/
|
|
100
|
-
fun Constants(vararg constants: Pair<String, Any?>) {
|
|
101
|
-
constantsProvider = { constants.toMap() }
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@Deprecated(
|
|
105
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
106
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
107
|
-
)
|
|
108
|
-
@JvmName("functionWithoutArgs")
|
|
109
|
-
inline fun function(
|
|
110
|
-
name: String,
|
|
111
|
-
crossinline body: () -> Any?
|
|
112
|
-
) {
|
|
113
|
-
methods[name] = AsyncFunction(name, arrayOf()) { body() }
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@Deprecated(
|
|
117
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
118
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
119
|
-
)
|
|
120
|
-
inline fun <reified R> function(
|
|
121
|
-
name: String,
|
|
122
|
-
crossinline body: () -> R
|
|
123
|
-
) {
|
|
124
|
-
methods[name] = AsyncFunction(name, arrayOf()) { body() }
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@Deprecated(
|
|
128
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
129
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
130
|
-
)
|
|
131
|
-
inline fun <reified R, reified P0> function(
|
|
132
|
-
name: String,
|
|
133
|
-
crossinline body: (p0: P0) -> R
|
|
134
|
-
) {
|
|
135
|
-
methods[name] = if (P0::class == Promise::class) {
|
|
136
|
-
AsyncFunctionWithPromise(name, arrayOf()) { _, promise -> body(promise as P0) }
|
|
137
|
-
} else {
|
|
138
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType())) { body(it[0] as P0) }
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@Deprecated(
|
|
143
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
144
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
145
|
-
)
|
|
146
|
-
inline fun <reified R, reified P0, reified P1> function(
|
|
147
|
-
name: String,
|
|
148
|
-
crossinline body: (p0: P0, p1: P1) -> R
|
|
149
|
-
) {
|
|
150
|
-
methods[name] = if (P1::class == Promise::class) {
|
|
151
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType())) { args, promise -> body(args[0] as P0, promise as P1) }
|
|
152
|
-
} else {
|
|
153
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType())) { body(it[0] as P0, it[1] as P1) }
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
@Deprecated(
|
|
158
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
159
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
160
|
-
)
|
|
161
|
-
inline fun <reified R, reified P0, reified P1, reified P2> function(
|
|
162
|
-
name: String,
|
|
163
|
-
crossinline body: (p0: P0, p1: P1, p2: P2) -> R
|
|
164
|
-
) {
|
|
165
|
-
methods[name] = if (P2::class == Promise::class) {
|
|
166
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, promise as P2) }
|
|
167
|
-
} else {
|
|
168
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2) }
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
@Deprecated(
|
|
173
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
174
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
175
|
-
)
|
|
176
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> function(
|
|
177
|
-
name: String,
|
|
178
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3) -> R
|
|
179
|
-
) {
|
|
180
|
-
methods[name] = if (P3::class == Promise::class) {
|
|
181
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, promise as P3) }
|
|
182
|
-
} else {
|
|
183
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3) }
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
@Deprecated(
|
|
188
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
189
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
190
|
-
)
|
|
191
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> function(
|
|
192
|
-
name: String,
|
|
193
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R
|
|
194
|
-
) {
|
|
195
|
-
methods[name] = if (P4::class == Promise::class) {
|
|
196
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, promise as P4) }
|
|
197
|
-
} else {
|
|
198
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4) }
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
@Deprecated(
|
|
203
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
204
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
205
|
-
)
|
|
206
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> function(
|
|
207
|
-
name: String,
|
|
208
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R
|
|
209
|
-
) {
|
|
210
|
-
methods[name] = if (P5::class == Promise::class) {
|
|
211
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, args[4] as P4, promise as P5) }
|
|
212
|
-
} else {
|
|
213
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5) }
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
@Deprecated(
|
|
218
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
219
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
220
|
-
)
|
|
221
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> function(
|
|
222
|
-
name: String,
|
|
223
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R
|
|
224
|
-
) {
|
|
225
|
-
methods[name] = if (P6::class == Promise::class) {
|
|
226
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, args[4] as P4, args[5] as P5, promise as P6) }
|
|
227
|
-
} else {
|
|
228
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5, it[6] as P6) }
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
@Deprecated(
|
|
233
|
-
message = "The 'function' component was deprecated and will change its behavior in the future.",
|
|
234
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
235
|
-
)
|
|
236
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> function(
|
|
237
|
-
name: String,
|
|
238
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R
|
|
239
|
-
) {
|
|
240
|
-
methods[name] = if (P7::class == Promise::class) {
|
|
241
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, args[4] as P4, args[5] as P5, args[6] as P6, promise as P7) }
|
|
242
|
-
} else {
|
|
243
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType(), typeOf<P7>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5, it[6] as P6, it[7] as P7) }
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
@Deprecated(
|
|
248
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
249
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
250
|
-
)
|
|
251
|
-
@JvmName("asyncFunctionWithoutArgs")
|
|
252
|
-
inline fun asyncFunction(
|
|
253
|
-
name: String,
|
|
254
|
-
crossinline body: () -> Any?
|
|
255
|
-
) = AsyncFunction(name, body)
|
|
256
|
-
|
|
257
|
-
@JvmName("AsyncFunctionWithoutArgs")
|
|
258
|
-
inline fun AsyncFunction(
|
|
259
|
-
name: String,
|
|
260
|
-
crossinline body: () -> Any?
|
|
261
|
-
) {
|
|
262
|
-
methods[name] = AsyncFunction(name, arrayOf()) { body() }
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
@Deprecated(
|
|
266
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
267
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
268
|
-
)
|
|
269
|
-
inline fun <reified R> asyncFunction(
|
|
270
|
-
name: String,
|
|
271
|
-
crossinline body: () -> R
|
|
272
|
-
) = AsyncFunction(name, body)
|
|
273
|
-
|
|
274
|
-
inline fun <reified R> AsyncFunction(
|
|
275
|
-
name: String,
|
|
276
|
-
crossinline body: () -> R
|
|
277
|
-
) {
|
|
278
|
-
methods[name] = AsyncFunction(name, arrayOf()) { body() }
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
@Deprecated(
|
|
282
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
283
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
284
|
-
)
|
|
285
|
-
inline fun <reified R, reified P0> asyncFunction(
|
|
286
|
-
name: String,
|
|
287
|
-
crossinline body: (p0: P0) -> R
|
|
288
|
-
) = AsyncFunction(name, body)
|
|
289
|
-
|
|
290
|
-
inline fun <reified R, reified P0> AsyncFunction(
|
|
291
|
-
name: String,
|
|
292
|
-
crossinline body: (p0: P0) -> R
|
|
293
|
-
) {
|
|
294
|
-
methods[name] = if (P0::class == Promise::class) {
|
|
295
|
-
AsyncFunctionWithPromise(name, arrayOf()) { _, promise -> body(promise as P0) }
|
|
296
|
-
} else {
|
|
297
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType())) { body(it[0] as P0) }
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
@Deprecated(
|
|
302
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
303
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
304
|
-
)
|
|
305
|
-
inline fun <reified R, reified P0, reified P1> asyncFunction(
|
|
306
|
-
name: String,
|
|
307
|
-
crossinline body: (p0: P0, p1: P1) -> R
|
|
308
|
-
) = AsyncFunction(name, body)
|
|
309
|
-
|
|
310
|
-
inline fun <reified R, reified P0, reified P1> AsyncFunction(
|
|
311
|
-
name: String,
|
|
312
|
-
crossinline body: (p0: P0, p1: P1) -> R
|
|
313
|
-
) {
|
|
314
|
-
methods[name] = if (P1::class == Promise::class) {
|
|
315
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType())) { args, promise -> body(args[0] as P0, promise as P1) }
|
|
316
|
-
} else {
|
|
317
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType())) { body(it[0] as P0, it[1] as P1) }
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
@Deprecated(
|
|
322
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
323
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
324
|
-
)
|
|
325
|
-
inline fun <reified R, reified P0, reified P1, reified P2> asyncFunction(
|
|
326
|
-
name: String,
|
|
327
|
-
crossinline body: (p0: P0, p1: P1, p2: P2) -> R
|
|
328
|
-
) = AsyncFunction(name, body)
|
|
329
|
-
|
|
330
|
-
inline fun <reified R, reified P0, reified P1, reified P2> AsyncFunction(
|
|
331
|
-
name: String,
|
|
332
|
-
crossinline body: (p0: P0, p1: P1, p2: P2) -> R
|
|
333
|
-
) {
|
|
334
|
-
methods[name] = if (P2::class == Promise::class) {
|
|
335
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, promise as P2) }
|
|
336
|
-
} else {
|
|
337
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2) }
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
@Deprecated(
|
|
342
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
343
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
344
|
-
)
|
|
345
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> asyncFunction(
|
|
346
|
-
name: String,
|
|
347
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3) -> R
|
|
348
|
-
) = AsyncFunction(name, body)
|
|
349
|
-
|
|
350
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> AsyncFunction(
|
|
351
|
-
name: String,
|
|
352
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3) -> R
|
|
353
|
-
) {
|
|
354
|
-
methods[name] = if (P3::class == Promise::class) {
|
|
355
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, promise as P3) }
|
|
356
|
-
} else {
|
|
357
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3) }
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
@Deprecated(
|
|
362
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
363
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
364
|
-
)
|
|
365
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> asyncFunction(
|
|
366
|
-
name: String,
|
|
367
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R
|
|
368
|
-
) = AsyncFunction(name, body)
|
|
369
|
-
|
|
370
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> AsyncFunction(
|
|
371
|
-
name: String,
|
|
372
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R
|
|
373
|
-
) {
|
|
374
|
-
methods[name] = if (P4::class == Promise::class) {
|
|
375
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, promise as P4) }
|
|
376
|
-
} else {
|
|
377
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4) }
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
@Deprecated(
|
|
382
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
383
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
384
|
-
)
|
|
385
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> asyncFunction(
|
|
386
|
-
name: String,
|
|
387
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R
|
|
388
|
-
) = AsyncFunction(name, body)
|
|
389
|
-
|
|
390
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> AsyncFunction(
|
|
391
|
-
name: String,
|
|
392
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R
|
|
393
|
-
) {
|
|
394
|
-
methods[name] = if (P5::class == Promise::class) {
|
|
395
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, args[4] as P4, promise as P5) }
|
|
396
|
-
} else {
|
|
397
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5) }
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
@Deprecated(
|
|
402
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
403
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
404
|
-
)
|
|
405
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> asyncFunction(
|
|
406
|
-
name: String,
|
|
407
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R
|
|
408
|
-
) = AsyncFunction(name, body)
|
|
409
|
-
|
|
410
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> AsyncFunction(
|
|
411
|
-
name: String,
|
|
412
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R
|
|
413
|
-
) {
|
|
414
|
-
methods[name] = if (P6::class == Promise::class) {
|
|
415
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, args[4] as P4, args[5] as P5, promise as P6) }
|
|
416
|
-
} else {
|
|
417
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5, it[6] as P6) }
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
@Deprecated(
|
|
422
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
423
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
424
|
-
)
|
|
425
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> asyncFunction(
|
|
426
|
-
name: String,
|
|
427
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R
|
|
428
|
-
) = AsyncFunction(name, body)
|
|
429
|
-
|
|
430
|
-
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> AsyncFunction(
|
|
431
|
-
name: String,
|
|
432
|
-
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R
|
|
433
|
-
) {
|
|
434
|
-
methods[name] = if (P7::class == Promise::class) {
|
|
435
|
-
AsyncFunctionWithPromise(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType())) { args, promise -> body(args[0] as P0, args[1] as P1, args[2] as P2, args[3] as P3, args[4] as P4, args[5] as P5, args[6] as P6, promise as P7) }
|
|
436
|
-
} else {
|
|
437
|
-
AsyncFunction(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType(), typeOf<P7>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5, it[6] as P6, it[7] as P7) }
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
@Deprecated(
|
|
442
|
-
message = "The 'asyncFunction' component was renamed to 'AsyncFunction'.",
|
|
443
|
-
replaceWith = ReplaceWith("AsyncFunction(name, body)")
|
|
444
|
-
)
|
|
445
|
-
fun asyncFunction(
|
|
446
|
-
name: String
|
|
447
|
-
) = AsyncFunction(name)
|
|
448
|
-
|
|
449
|
-
fun AsyncFunction(
|
|
450
|
-
name: String
|
|
451
|
-
) = AsyncFunctionBuilder(name).also { functionBuilders.add(it) }
|
|
452
|
-
|
|
453
|
-
@Deprecated(
|
|
454
|
-
message = "The 'viewManager' component was renamed to 'ViewManager'.",
|
|
455
|
-
replaceWith = ReplaceWith("ViewManager(body)")
|
|
456
|
-
)
|
|
457
|
-
inline fun viewManager(body: ViewManagerDefinitionBuilder.() -> Unit) = ViewManager(body)
|
|
458
|
-
|
|
459
45
|
/**
|
|
460
46
|
* Creates the view manager definition that scopes other view-related definitions.
|
|
461
47
|
*/
|
|
@@ -467,12 +53,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
467
53
|
viewManagerDefinition = viewManagerDefinitionBuilder.build()
|
|
468
54
|
}
|
|
469
55
|
|
|
470
|
-
@Deprecated(
|
|
471
|
-
message = "The 'onCreate' component was renamed to 'OnCreate'.",
|
|
472
|
-
replaceWith = ReplaceWith("OnCreate(body)")
|
|
473
|
-
)
|
|
474
|
-
inline fun onCreate(crossinline body: () -> Unit) = OnCreate(body)
|
|
475
|
-
|
|
476
56
|
/**
|
|
477
57
|
* Creates module's lifecycle listener that is called right after the module initialization.
|
|
478
58
|
*/
|
|
@@ -480,12 +60,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
480
60
|
eventListeners[EventName.MODULE_CREATE] = BasicEventListener(EventName.MODULE_CREATE) { body() }
|
|
481
61
|
}
|
|
482
62
|
|
|
483
|
-
@Deprecated(
|
|
484
|
-
message = "The 'onDestroy' component was renamed to 'OnDestroy'.",
|
|
485
|
-
replaceWith = ReplaceWith("OnDestroy(body)")
|
|
486
|
-
)
|
|
487
|
-
inline fun onDestroy(crossinline body: () -> Unit) = OnDestroy(body)
|
|
488
|
-
|
|
489
63
|
/**
|
|
490
64
|
* Creates module's lifecycle listener that is called when the module is about to be deallocated.
|
|
491
65
|
*/
|
|
@@ -493,12 +67,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
493
67
|
eventListeners[EventName.MODULE_DESTROY] = BasicEventListener(EventName.MODULE_DESTROY) { body() }
|
|
494
68
|
}
|
|
495
69
|
|
|
496
|
-
@Deprecated(
|
|
497
|
-
message = "The 'onActivityEntersForeground' component was renamed to 'OnActivityEntersForeground'.",
|
|
498
|
-
replaceWith = ReplaceWith("OnActivityEntersForeground(body)")
|
|
499
|
-
)
|
|
500
|
-
inline fun onActivityEntersForeground(crossinline body: () -> Unit) = OnActivityEntersForeground(body)
|
|
501
|
-
|
|
502
70
|
/**
|
|
503
71
|
* Creates module's lifecycle listener that is called right after the activity is resumed.
|
|
504
72
|
*/
|
|
@@ -506,12 +74,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
506
74
|
eventListeners[EventName.ACTIVITY_ENTERS_FOREGROUND] = BasicEventListener(EventName.ACTIVITY_ENTERS_FOREGROUND) { body() }
|
|
507
75
|
}
|
|
508
76
|
|
|
509
|
-
@Deprecated(
|
|
510
|
-
message = "The 'onActivityEntersBackground' component was renamed to 'OnActivityEntersBackground'.",
|
|
511
|
-
replaceWith = ReplaceWith("OnActivityEntersBackground(body)")
|
|
512
|
-
)
|
|
513
|
-
inline fun onActivityEntersBackground(crossinline body: () -> Unit) = OnActivityEntersBackground(body)
|
|
514
|
-
|
|
515
77
|
/**
|
|
516
78
|
* Creates module's lifecycle listener that is called right after the activity is paused.
|
|
517
79
|
*/
|
|
@@ -519,12 +81,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
519
81
|
eventListeners[EventName.ACTIVITY_ENTERS_BACKGROUND] = BasicEventListener(EventName.ACTIVITY_ENTERS_BACKGROUND) { body() }
|
|
520
82
|
}
|
|
521
83
|
|
|
522
|
-
@Deprecated(
|
|
523
|
-
message = "The 'onActivityDestroys' component was renamed to 'OnActivityDestroys'.",
|
|
524
|
-
replaceWith = ReplaceWith("OnActivityDestroys(body)")
|
|
525
|
-
)
|
|
526
|
-
inline fun onActivityDestroys(crossinline body: () -> Unit) = OnActivityDestroys(body)
|
|
527
|
-
|
|
528
84
|
/**
|
|
529
85
|
* Creates module's lifecycle listener that is called right after the activity is destroyed.
|
|
530
86
|
*/
|
|
@@ -532,51 +88,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
532
88
|
eventListeners[EventName.ACTIVITY_DESTROYS] = BasicEventListener(EventName.ACTIVITY_DESTROYS) { body() }
|
|
533
89
|
}
|
|
534
90
|
|
|
535
|
-
@Deprecated(
|
|
536
|
-
message = "The 'events' component was renamed to 'Events'.",
|
|
537
|
-
replaceWith = ReplaceWith("Events(events)")
|
|
538
|
-
)
|
|
539
|
-
fun events(vararg events: String) = Events(*events)
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Defines event names that this module can send to JavaScript.
|
|
543
|
-
*/
|
|
544
|
-
fun Events(vararg events: String) {
|
|
545
|
-
eventsDefinition = EventsDefinition(events)
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
@Deprecated(
|
|
549
|
-
message = "The 'onStartObserving' component was renamed to 'OnStartObserving'.",
|
|
550
|
-
replaceWith = ReplaceWith("OnStartObserving(body)")
|
|
551
|
-
)
|
|
552
|
-
inline fun onStartObserving(crossinline body: () -> Unit) = OnStartObserving(body)
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Creates module's lifecycle listener that is called right after the first event listener is added.
|
|
556
|
-
*/
|
|
557
|
-
inline fun OnStartObserving(crossinline body: () -> Unit) {
|
|
558
|
-
AsyncFunction("startObserving", body)
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
@Deprecated(
|
|
562
|
-
message = "The 'onStopObserving' component was renamed to 'OnStopObserving'.",
|
|
563
|
-
replaceWith = ReplaceWith("OnStopObserving(body)")
|
|
564
|
-
)
|
|
565
|
-
inline fun onStopObserving(crossinline body: () -> Unit) = OnStopObserving(body)
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Creates module's lifecycle listener that is called right after all event listeners are removed.
|
|
569
|
-
*/
|
|
570
|
-
inline fun OnStopObserving(crossinline body: () -> Unit) {
|
|
571
|
-
AsyncFunction("stopObserving", body)
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
@Deprecated(
|
|
575
|
-
message = "The 'onNewIntent' component was renamed to 'OnNewIntent'.",
|
|
576
|
-
replaceWith = ReplaceWith("OnNewIntent(body)")
|
|
577
|
-
)
|
|
578
|
-
inline fun onNewIntent(crossinline body: (Intent) -> Unit) = OnNewIntent(body)
|
|
579
|
-
|
|
580
91
|
/**
|
|
581
92
|
* Creates module's lifecycle listener that is called right after the new intent was received.
|
|
582
93
|
*/
|
|
@@ -584,12 +95,6 @@ class ModuleDefinitionBuilder(@PublishedApi internal val module: Module? = null)
|
|
|
584
95
|
eventListeners[EventName.ON_NEW_INTENT] = EventListenerWithPayload<Intent>(EventName.ON_NEW_INTENT) { body(it) }
|
|
585
96
|
}
|
|
586
97
|
|
|
587
|
-
@Deprecated(
|
|
588
|
-
message = "The 'onActivityResult' component was renamed to 'OnActivityResult'.",
|
|
589
|
-
replaceWith = ReplaceWith("OnActivityResult(body)")
|
|
590
|
-
)
|
|
591
|
-
inline fun onActivityResult(crossinline body: (Activity, OnActivityResultPayload) -> Unit) = OnActivityResult(body)
|
|
592
|
-
|
|
593
98
|
/**
|
|
594
99
|
* Creates module's lifecycle listener that is called right after the activity has received a result.
|
|
595
100
|
*/
|