Chatwoot/app/dispatchers/dispatcher.rb
Pranav Raj Sreepuram 2a34255e0b Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com>
Co-authored-by: Manoj <manojmj92@gmail.com>
Co-authored-by: Nithin <webofnithin@gmail.com>
2019-08-14 15:18:44 +05:30

24 lines
620 B
Ruby

class Dispatcher
include Singleton
attr_reader :async_dispatcher, :sync_dispatcher
def self.dispatch(event_name, timestamp, data, async = false)
$dispatcher.dispatch(event_name, timestamp, data, async)
end
def initialize
@sync_dispatcher = SyncDispatcher.new
@async_dispatcher = AsyncDispatcher.new
end
def dispatch(event_name, timestamp, data, async = false)
@sync_dispatcher.dispatch(event_name, timestamp, data)
@async_dispatcher.dispatch(event_name, timestamp, data)
end
def load_listeners
@sync_dispatcher.load_listeners
@async_dispatcher.load_listeners
end
end