lib/volt/reactive/events.rb in volt-0.5.18 vs lib/volt/reactive/events.rb in volt-0.6.0
- old
+ new
@@ -199,7 +199,21 @@
# Takes a block, which passes in
def trigger_by_scope!(event, *args, &block)
trigger!(event, block, *args)
end
+
+ # Takes an event and a list of method names, and triggers the event for each listener
+ # coming off of those methods.
+ def trigger_for_methods!(event, *method_names)
+ trigger_by_scope!(event, [], nil) do |scope|
+ if scope
+ method_name = scope.first
+
+ method_names.include?(method_name)
+ else
+ false
+ end
+ end
+ end
end
\ No newline at end of file