mirror of
https://github.com/ethauvin/kobalt-doc.git
synced 2025-04-25 12:07:10 -07:00
Better example.
This commit is contained in:
parent
34d09120ac
commit
0a6d74672c
1 changed files with 5 additions and 7 deletions
|
@ -339,16 +339,14 @@ myConfig(project) {
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@Directive
|
@Directive
|
||||||
public fun myConfig(project: Project, init: Info.() -> Unit) : Info {
|
public fun myConfig(init: Info.() -> Unit) = Info().apply {
|
||||||
val info = Info()
|
init()
|
||||||
info.init()
|
|
||||||
(Kobalt.findPlugin("my-plug-in") as MyPlugin).info = info
|
(Kobalt.findPlugin("my-plug-in") as MyPlugin).info = info
|
||||||
return info
|
this
|
||||||
}
|
}</pre>
|
||||||
</pre>
|
|
||||||
<p>
|
<p>
|
||||||
Obviously, you can choose any kind of API to communicate between the directive and its plug-in. In the code
|
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 <code>Info</code> field, but you could instead choose to call
|
above, I chose to directly override the entire <code>Info</code> field, but you could instead choose to call
|
||||||
a function, just set one boolean instead of the whole object, etc...
|
a function, just set one boolean instead of the whole object, etc...
|
||||||
</p>
|
</p>
|
||||||
<h2 class="section" id="tasks">Tasks</h2>
|
<h2 class="section" id="tasks">Tasks</h2>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue