add create as _factory method

This commit is contained in:
Alexey Gulev
2019-03-27 22:00:02 +01:00
parent cb82acd5da
commit d5c3aae745
3 changed files with 14 additions and 21 deletions

View File

@@ -24,14 +24,18 @@ function init(self)
self.druid:new_button("button_1", function()
print("On button 1")
end)
self.druid:new_button("button_2", function()
--alternative way of component registration
self.druid:create(druid.comps.button, "button_2", function()
print("On button 2")
end)
self.druid:new_button("button_3", function()
print("On button 3")
end)
druid.register("my_custom_component", {})
self.druid:new_android_back(function(self, params)
print("On android back", params)
end, 2)