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