lib/wisper.rb in wisper-1.0.0 vs lib/wisper.rb in wisper-1.0.1

- old
+ new

@@ -1,9 +1,11 @@ require "wisper/version" require "wisper/registration/registration" require "wisper/registration/object" +require "wisper/registration/object/async_listener" require "wisper/registration/block" +require 'wisper/global_listeners' module Wisper def listeners @listeners ||= Set.new end @@ -27,11 +29,15 @@ alias :on :respond_to private + def all_listeners + listeners.merge(GlobalListeners.listeners) + end + def broadcast(event, *args) - listeners.each do | listener | + all_listeners.each do | listener | listener.broadcast(clean_event(event), *args) end end alias :publish :broadcast