motion/reactor.rb in bubble-wrap-1.8.0 vs motion/reactor.rb in bubble-wrap-1.9.0
- old
+ new
@@ -65,20 +65,20 @@
# BubbleWrap::Reactor.defer(operation,callback)
# The action of `defer` is to take the block specified in the first
# parameter (the "operation") and schedule it for asynchronous execution
# on a GCD concurrency queue. When the operation completes the result (if any)
# is passed into the callback (if present).
- def defer(op=nil,cb=nil,&blk)
+ def defer(op=nil,cb=nil,&blk)
schedule do
result = (op||blk).call
schedule(result, &cb) if cb
end
end
# A version of `defer` which schedules both the operator
# and callback operations on the application's main thread.
- def defer_on_main(op=nil,cb=nil,&blk)
+ def defer_on_main(op=nil,cb=nil,&blk)
schedule_on_main do
result = (op||blk).call
schedule_on_main(result, &cb) if cb
end
end
@@ -103,10 +103,10 @@
cb = proc do
blk.call(*args)
end
::Dispatch::Queue.main.async &cb
end
-
+
end
end
::EM = ::BubbleWrap::Reactor unless defined?(::EM) # Yes I dare!