diff --git a/README.md b/README.md index 7f7c5c9..5b004db 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ Any events can handle several callbacks, if needed. ## 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 diff --git a/docs_md/02-creating_custom_components.md b/docs_md/02-creating_custom_components.md index d761462..bcebe7d 100644 --- a/docs_md/02-creating_custom_components.md +++ b/docs_md/02-creating_custom_components.md @@ -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: