lib/preact.rb in isomorfeus-preact-10.6.56 vs lib/preact.rb in isomorfeus-preact-10.6.57
- old
+ new
@@ -128,18 +128,11 @@
let active_c = self.active_component();
result[self.lower_camelize(key)] = function(event, info) {
let ruby_event = self.native_to_ruby_event(event);
#{`active_c.__ruby_instance`.instance_exec(`ruby_event`, `info`, &`value`)};
}
- } else if (type === "object" && typeof value.m === "object" && typeof value.m.$call === "function" ) {
- if (!value.preact_event_handler_function) {
- value.preact_event_handler_function = function(event, info) {
- let ruby_event = self.native_to_ruby_event(event);
- if (value.a.length > 0) { value.m.$call.apply(value.m, [ruby_event, info].concat(value.a)); }
- else { value.m.$call(ruby_event, info); }
- };
- }
+ } else if (typeof value.preact_event_handler_function === "function") {
result[self.lower_camelize(key)] = value.preact_event_handler_function;
} else if (type === "string" ) {
let active_component = self.active_component();
let method_ref;
let method_name = '$' + value;
@@ -152,15 +145,9 @@
// got a native instance
if (active_component.method_refs?.[value]) { method_ref = active_component.method_refs[value]; }
else { method_ref = active_component.__ruby_instance.$method_ref(value); } // create ref for native
}
if (method_ref) {
- if (!method_ref.preact_event_handler_function) {
- method_ref.preact_event_handler_function = function(event, info) {
- let ruby_event = self.native_to_ruby_event(event);
- method_ref.m.$call(ruby_event, info)
- };
- }
result[self.lower_camelize(key)] = method_ref.preact_event_handler_function;
} else {
let component_name;
if (active_component.__ruby_instance) { component_name = active_component.__ruby_instance.$to_s(); }
else { component_name = active_component.$to_s(); }