Class: Promise
Class Method Summary collapse
-
.defer(*args, &block) ⇒ Object
Create a promise which will be resolved with the result of the immediate.
Class Method Details
.defer(*args, &block) ⇒ Object
Create a promise which will be resolved with the result of the immediate.
152 153 154 155 156 157 158 159 160 161 162 |
# File 'opal/browser/immediate.rb', line 152 def self.defer(*args, &block) new.tap {|promise| proc { begin promise.resolve(block.call(*args)) rescue Exception => e promise.reject(e) end }.defer } end |