lib/vedeu/main_loop.rb in vedeu-0.4.0 vs lib/vedeu/main_loop.rb in vedeu-0.4.1
- old
+ new
@@ -1,9 +1,13 @@
module Vedeu
# Provides the main loop for a Vedeu application.
#
+ # Each time Vedeu starts one cycle in the application loop, it triggers the
+ # `:tick` event. A completion of that cycle will trigger `:tock`. This can be
+ # used by the client application for timing amongst other things.
+ #
class MainLoop
trap('SIGTERM') { stop! }
trap('TERM') { stop! }
trap('INT') { stop! }
@@ -15,11 +19,11 @@
def self.start!(&block)
@started = true
@loop = true
while(@loop) do
- Vedeu.trigger(:_tick_)
+ Vedeu.trigger(:tick)
yield
safe_exit_point!
end
@@ -43,10 +47,10 @@
def self.safe_exit_point!
if @started && !@loop
fail VedeuInterrupt
else
- Vedeu.trigger(:_tock_)
+ Vedeu.trigger(:tock)
end
end
end # MainLoop