~singpolyma/sgx-jmp

ref: d1f8b6acad86682198b42e074962df3aa732ed56 sgx-jmp/lib/em.rb -rw-r--r-- 246 bytes
d1f8b6acStephen Paul Weber New signup: go to web to choose credit card 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

require "em_promise"

module EM
	def self.promise_defer(klass: EMPromise, &block)
		promise = klass.new
		EventMachine.defer(
			block,
			promise.method(:fulfill),
			promise.method(:reject)
		)
		promise
	end
end