mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Update docs
This commit is contained in:
@@ -82,7 +82,9 @@
|
||||
<p><a name="Overview"></a></p>
|
||||
<h2>Overview</h2>
|
||||
|
||||
<p>Druid allows you to create your custom components from druid basic components or other custom components</p>
|
||||
<p>Druid allows you to create your custom components from druid basic components or other custom components.</p>
|
||||
|
||||
<p>Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via self:{method_name}</p>
|
||||
|
||||
|
||||
<p><a name="Custom_components"></a></p>
|
||||
@@ -94,7 +96,7 @@
|
||||
<span class="keyword">local</span> const = <span class="global">require</span>(<span class="string">"druid.const"</span>)
|
||||
<span class="keyword">local</span> component = <span class="global">require</span>(<span class="string">"druid.component"</span>)
|
||||
|
||||
<span class="keyword">local</span> M = component.create(<span class="string">"name_your_component"</span>)
|
||||
<span class="keyword">local</span> M = component.create(<span class="string">"my_component"</span>)
|
||||
|
||||
<span class="comment">-- Component constructor
|
||||
</span><span class="keyword">function</span> M.init(self, ...)
|
||||
@@ -146,16 +148,22 @@
|
||||
</pre>
|
||||
|
||||
|
||||
<p>Registering make new function with "new<em>{component</em>name}". In our example it will be: <code>druid:new_my_component()</code></p>
|
||||
<p>Registering make new function with "new<em>{component</em>name}". In our example it will be: <code>druid:new_my_component()</code>.</p>
|
||||
|
||||
<p>Or you can create component without registering with <code>druid:create(my_component_module)</code></p>
|
||||
|
||||
<p>As component registered, you can create your component with next code:</p>
|
||||
|
||||
<pre>
|
||||
<span class="keyword">local</span> druid = <span class="global">require</span>(<span class="string">"druid.druid"</span>)
|
||||
<span class="keyword">local</span> my_component = <span class="global">require</span>(<span class="string">"my.amazing.component"</span>)
|
||||
|
||||
<span class="keyword">function</span> init(self)
|
||||
self.druid = druid.new(self)
|
||||
|
||||
<span class="keyword">local</span> my_component = self.druid:new_my_component(...)
|
||||
<span class="comment">-- or --
|
||||
</span> <span class="keyword">local</span> my_component = self.druid:create(my_component, ...)
|
||||
<span class="keyword">end</span>
|
||||
</pre>
|
||||
|
||||
@@ -225,7 +233,7 @@ There is next interests in druid:
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2020-04-09 22:11:32 </i>
|
||||
<i style="float:right;">Last updated 2020-04-13 19:36:00 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user