Start using sinatra & ruby for backend
Signed-off-by: Syed Daanish <me@syedm.dev>
This commit is contained in:
12
event_bus.rb
Normal file
12
event_bus.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# Event bus
|
||||
module EventBus
|
||||
@events = {}
|
||||
|
||||
def self.on(event, &callback)
|
||||
@events[event] = callback
|
||||
end
|
||||
|
||||
def self.get(event, *args)
|
||||
@events[event]&.call(*args)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user