diff --git a/plug-in-development/index.html b/plug-in-development/index.html index 36de0d6..7f8e00d 100644 --- a/plug-in-development/index.html +++ b/plug-in-development/index.html @@ -339,16 +339,14 @@ myConfig(project) {
 @Directive
-public fun myConfig(project: Project, init: Info.() -> Unit) : Info {
-    val info = Info()
-    info.init()
+public fun myConfig(init: Info.() -> Unit) = Info().apply {
+    init()
     (Kobalt.findPlugin("my-plug-in") as MyPlugin).info = info
-    return info
-}
-
+ this +}

Obviously, you can choose any kind of API to communicate between the directive and its plug-in. In the code - above, I chose to directly overrid the entire Info field, but you could instead choose to call + above, I chose to directly override the entire Info field, but you could instead choose to call a function, just set one boolean instead of the whole object, etc...

Tasks