From 85e5cee1541f740458ffe85f2e9ad7b7b670f2af Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 15 Dec 2022 14:59:07 +0600 Subject: [PATCH] replace createStartupPluginAndRegister --- .../jsMain/kotlin/CreateStartupPluginAndRegister.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename startup/{launcher => plugin}/src/jsMain/kotlin/CreateStartupPluginAndRegister.kt (55%) diff --git a/startup/launcher/src/jsMain/kotlin/CreateStartupPluginAndRegister.kt b/startup/plugin/src/jsMain/kotlin/CreateStartupPluginAndRegister.kt similarity index 55% rename from startup/launcher/src/jsMain/kotlin/CreateStartupPluginAndRegister.kt rename to startup/plugin/src/jsMain/kotlin/CreateStartupPluginAndRegister.kt index f1a743db4e7..e8ea6b511ed 100644 --- a/startup/launcher/src/jsMain/kotlin/CreateStartupPluginAndRegister.kt +++ b/startup/plugin/src/jsMain/kotlin/CreateStartupPluginAndRegister.kt @@ -1,14 +1,14 @@ -package dev.inmo.micro_utils.startup.launcher - -import dev.inmo.micro_utils.startup.plugin.StartPlugin -import dev.inmo.micro_utils.startup.plugin.StartPluginSerializer +package dev.inmo.micro_utils.startup.plugin /** * Creates [T] using [block], register it in [StartPluginSerializer] using its [StartPluginSerializer.registerPlugin] * and returns created by [block] plugin + * + * @param name Will be used as a key for registration in [StartPluginSerializer] and will be passed to the [block] as + * parameter */ -inline fun createStartupPluginAndRegister(name: String, block: () -> T): T { - val plugin = block() +inline fun createStartupPluginAndRegister(name: String, block: (String) -> T): T { + val plugin = block(name) StartPluginSerializer.registerPlugin(name, plugin) return plugin }