Sha256: e52f36386830cdb5cadb9270ff7085cc0a3f7a5bc38ecbe3b085fc347bddd2d0

Contents?: true

Size: 356 Bytes

Versions: 34

Compression:

Stored size: 356 Bytes

Contents

module Aws
  class EventEmitter

    def initialize
      @listeners = {}
    end

    def on(type, callback)
      (@listeners[type] ||= []) << callback
    end

    def signal(type, event)
      return unless @listeners[type]
      @listeners[type].each do |listener|
        listener.call(event) if event.event_type == type
      end
    end

  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
aws-sdk-core-3.46.2 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.46.1 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.46.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.45.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.44.2 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.44.1 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.44.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.43.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.42.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.41.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.40.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.39.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.38.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.37.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.36.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.35.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.34.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.33.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.32.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.31.0 lib/aws-sdk-core/event_emitter.rb