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

@ -144,7 +144,7 @@ Any events can handle several callbacks, if needed.
## Examples ## Examples
See the [example folder](https://github.com/insality/druid/tree/develop/example/kenney) for examples of how to use **Druid** See the [example folder](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**
See the [druid-assets repository](https://github.com/insality/druid-assets) for examples of how to create custom components and styles See the [druid-assets repository](https://github.com/insality/druid-assets) for examples of how to create custom components and styles

View File

@ -47,11 +47,23 @@ Add your custom component to druid via `druid.register`
local druid = require("druid.druid") local druid = require("druid.druid")
local my_component = require("my.amazing.component") local my_component = require("my.amazing.component")
local function init(self) function init(self)
druid.register("my_component", my_component) druid.register("my_component", my_component)
end 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
Interest - is a way to indicate what events your component will respond to. Interest - is a way to indicate what events your component will respond to.
There is next interests in druid: There is next interests in druid: