Update READMES

This commit is contained in:
Insality
2020-03-22 15:56:05 +03:00
parent 7c22032004
commit 017138b5ff
2 changed files with 14 additions and 2 deletions

View File

@@ -47,11 +47,23 @@ Add your custom component to druid via `druid.register`
local druid = require("druid.druid")
local my_component = require("my.amazing.component")
local function init(self)
function init(self)
druid.register("my_component", my_component)
end
```
Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`
As component registered, you can create your component with next code:
```lua
local druid = require("druid.druid")
function init(self)
self.druid = druid.new(self)
local my_component = self.druid:new_my_component(...)
end
```
### Interest
Interest - is a way to indicate what events your component will respond to.
There is next interests in druid: