lib/rubo/event_emitter.rb
# Adds a listener to the end of the listeners array for the specified event.
#
# @overload add_listener(type, once = false, &block)
#   @param type [Symbol]
#   @param once [Boolean]
#   @yield [*args]
#   @yieldparam args [Array]
# @overload add_listener(type, once = false, &block)
#   @param type [Symbol]
#   @param once [Boolean]
#   @yield [type, *args]
#   @yieldparam type [Symbol]
#   @yieldparam args [Array]
# @return [void]
Adds a listener to the end of the listeners array for the specified event.
Adds a listener to the end of the listeners array for the specified event .
def add_listener(type, once = false, &block)
      id = events.empty? ? 0 : events.last.id + 1
      events << Event.new(
        id: id,
        type: type.to_sym,
        listener: block,
        once: once,
      )
    end
def add_listener ( type , once = false , & block ) id = events . empty? ? 0 : events . last . id + 1 events << Event . new ( id : id , type : type . to_sym , listener : block , once : once , ) end
Adds a listener to the end of the listeners array for the specified event.
Adds a listener to the end of the listeners array for the specified event .
None
void
type
<not_specific>
once
<not_specific>
block
<not_specific>
overload
add_listener(type, once = false, █) @param type [Symbol] @param once [Boolean] @yield [*args] @yieldparam args [Array]
add_listener ( type once = false █ ) @param type [ Symbol ] @param once [ Boolean ] @yield [ * args ] @yieldparam args [ Array ]
overload
add_listener(type, once = false, █) @param type [Symbol] @param once [Boolean] @yield [type, *args] @yieldparam type [Symbol] @yieldparam args [Array]
add_listener ( type once = false █ ) @param type [ Symbol ] @param once [ Boolean ] @yield [ type * args ] @yieldparam type [ Symbol ] @yieldparam args [ Array ]