Sha256: e5f6832a85fe3dc9b836ef551d269368e1aad61d9ce1caf94f3b8c5fb90fc41a
Contents?: true
Size: 713 Bytes
Versions: 9
Compression:
Stored size: 713 Bytes
Contents
module React module Component module EventHandler def event_handlers @event_handlers ||= [] end def event_handler(name, &block) event_handlers << name %x{ var fun = function(event, info) { let ruby_event; if (typeof event === "object") { #{ruby_event = ::React::SyntheticEvent.new(`event`)}; } else { #{ruby_event = `event`}; } #{`this.__ruby_instance`.instance_exec(ruby_event, `info`, &block)}; } if (self.lucid_react_component) { self.lucid_react_component.prototype[name] = fun; } else { self.react_component.prototype[name] = fun; } } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems