motion/reactor.rb in bubble-wrap-1.1.5 vs motion/reactor.rb in bubble-wrap-1.2.0.pre

- old
+ new

@@ -35,12 +35,17 @@ end # Call `callback` or the passed block every `interval` seconds. # Returns a timer signature that can be passed into # `cancel_timer` - def add_periodic_timer(interval, callback=nil, &blk) + # Optionally supply a callback as a second argument instead of a block + # (as per EventMachine API) + # Optionally supply :common_modes => true in args to schedule the timer + # for the runloop "common modes" (NSRunLoopCommonModes) instead of + # the default runloop mode. + def add_periodic_timer(interval, *args, &blk) @timers ||= {} - timer = PeriodicTimer.new(interval,callback,&blk) + timer = PeriodicTimer.new(interval,*args,&blk) timer.on(:cancelled) do @timers.delete(timer) end @timers[timer.object_id] = timer timer.object_id