lib/rubo/event_emitter.rb
# Execute each of the listeners in order with the supplied arguments.
#
# @param type [Symbol]
# @param args [Array]
# @return [void]
Execute each of the listeners in order with the supplied arguments.
Execute each of the listeners in order with the supplied arguments .
def emit(type, *args)
      type = type.to_sym
      fired_events = []
      events.each do |e|
        case e.type
        when type
          listener = e.listener
          if listener
            fired_events << e if e.once?
            listener.call(*args)
          end
        when :*
          listener = e.listener
          if listener
            fired_events << e if e.once?
            listener.call(type, *args)
          end
        end
      end
      fired_events.each do |e|
        remove_listener(e.id)
      end
    end
def emit ( type , * args ) type = type . to_sym fired_events = [ ] events . each do | e | case e . type when type listener = e . listener if listener fired_events << e if e . once? listener . call ( * args ) end when :* listener = e . listener if listener fired_events << e if e . once? listener . call ( type , * args ) end end end fired_events . each do | e | remove_listener ( e . id ) end end
Execute each of the listeners in order with the supplied arguments.
Execute each of the listeners in order with the supplied arguments .
None
void
type
<not_specific>
args
<not_specific>
<not_specific>
None