README.textile in em-promise-1.0.3 vs README.textile in em-promise-1.1.0
- old
+ new
@@ -6,15 +6,14 @@
From the perspective of dealing with error handling, deferred and promise apis are to asynchronous programing what try, catch and throw keywords are to synchronous programming.
<pre><code class="ruby">
require 'rubygems'
-require 'eventmachine'
require 'em-promise'
def asyncGreet(name)
- deferred = EM::Defer.new
+ deferred = EM::Q.defer
EM::Timer.new(5) do
EM.defer do
deferred.resolve("Hello #{name}")
end
@@ -24,20 +23,24 @@
end
EventMachine.run do
- promise = asyncGreet('Robin Hood')
- promise.then(proc { |greeting|
+ asyncGreet('Robin Hood').then(proc { |greeting|
p "Success: #{greeting}"
}, proc { |reason|
p "Failed: #{reason}"
})
+ asyncGreet('The Dude').then do |greeting|
+ p "Jeff '#{greeting}' Lebowski"
+ end
+
end
</code></pre>
h2. Start using it now
-@gem install em-promise@
+# Read the "Documentation":http://rubydoc.info/gems/em-promise/EventMachine/Q
+# Then @gem install em-promise@