~singpolyma/sgx-jmp

2701f96dd160ce30530b3653bcaa011322bc67f2 — Stephen Paul Weber 1 year, 6 months ago 82bf4d3
Helper to get a promise that resolves after N seconds
1 files changed, 8 insertions(+), 0 deletions(-)

M lib/em.rb
M lib/em.rb => lib/em.rb +8 -0
@@ 24,4 24,12 @@ module EM
		}.resume
		promise
	end

	def self.promise_timer(timeout)
		promise = EMPromise.new
		EM.add_timer(timeout) do
			promise.fulfill(nil)
		end
		promise
	end
end