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.30.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.29.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.28.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.27.1 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.27.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.26.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.25.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.24.1 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.24.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.23.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.22.1 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.22.0 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.21.3 lib/aws-sdk-core/event_emitter.rb
aws-sdk-core-3.21.2 lib/aws-sdk-core/event_emitter.rb