Glimmer DSL for Web (Fukuoka Award Winning Frontend Framework for Ruby on Rails) versions 0.7.2 & 0.7.3 add new samples to demonstrate the newly added features of Component Attribute Listener and Component Attribute Data-Binding. So, not only could we listen to HTML element events like a select element's onchange event, but now, if you add any attribute to a component, it automatically supports having consumers listen to that attribute's updates by hooking into `on_attributename_update` by convention (this is the Rails Convention Over Configuration principle at play). Additionally, consumers could even automatically data-bind that attribute to a model attribute by using the typical Glimmer approach of <=> for bidirectional data-binding and <= for unidirectional data-binding.
Suppose we have an address type select box.
The address_type_select component code would be something like this:
No comments:
Post a Comment