lib/rails/graphql/helpers/with_events.rb
def on(event_name, unshift: false, &block)
          event_name = event_name.to_sym
          valid = !event_types || event_types.include?(event_name)
          raise ArgumentError, <<~MSG.squish unless valid
            The #{event_name} is not a valid event type.
          MSG

          listeners << event_name
          events[event_name].send(unshift ? :unshift : :push, block)
        end
# Add a new event listener for the given +event_name+. It is possible
# to prepend the event by setting +unshift: true+. This checks if the
# event name is a valid one due to +event_types+.
Add a new event listener for the given +event_name+. It is possible
to prepend the event by setting +unshift: true+. This checks if the
event name is a valid one due to +event_types+.
Add a new event listener for the given + event_name + . It is possible to prepend the event by setting + unshift : true + . This checks if the event name is a valid one due to + event_types + .
def on(event_name, unshift: false, &block)
          event_name = event_name.to_sym
          valid = !event_types || event_types.include?(event_name)
          raise ArgumentError, <<~MSG.squish unless valid
            The #{event_name} is not a valid event type.
          MSG
          listeners << event_name
          events[event_name].send(unshift ? :unshift : :push, block)
        end
def on ( event_name , unshift : false , & block ) event_name = event_name . to_sym valid = ! event_types || event_types . include? ( event_name ) raise ArgumentError , <<~MSG . squish unless valid 
            The  #{ event_name }  is not a valid event type.
           MSG listeners << event_name events [ event_name ] . send ( unshift ? :unshift : :push , block ) end
Add a new event listener for the given +event_name+.
Add a new event listener for the given + event_name + .
event_name
unshift
block