Module: LucidComponent::EventHandler
- Defined in:
- lib/lucid_component/event_handler.rb
Instance Method Summary collapse
Instance Method Details
#event_handler(name, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/lucid_component/event_handler.rb', line 7 def event_handler(name, &block) event_handlers << name %x{ self.lucid_react_component.prototype[name] = function(event, info) { #{ruby_event = ::React::SyntheticEvent.new(`event`)}; #{`this.__ruby_instance`.instance_exec(ruby_event, `info`, &block)}; } } end |
#event_handlers ⇒ Object
3 4 5 |
# File 'lib/lucid_component/event_handler.rb', line 3 def event_handlers @event_handlers ||= [] end |