Sha256: fbe2f469765c5c7c0116c1945d5f473f49435b74a141b1b3b98175652ad83bbf

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

module NodeRb

  class << self

    def next_tick params = nil, &block
      next_tick_schedule(block, params)
    end

    def next_tick_schedule block, params
      @next_tick ||= []
      @next_tick << [block, params]
      NodeRb.send(:next_tick_native)
    end

    def next_tick_execute
      blocks, @next_tick = @next_tick, []
      blocks.each do |block|
        block, params = block
        params ? block.call(params) : block.call
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
noderb-0.0.12 lib/noderb/next_tick.rb