Sha256: ac95f314af5b4b89e1d3966621e13ddede96a0e85feb8e4913e7f67d7a82f99c

Contents?: true

Size: 691 Bytes

Versions: 21

Compression:

Stored size: 691 Bytes

Contents

# The draw cycle is responsible for queueing redraws until all of the events have
# fired.  Once that is done, everything will be redrawn.  This prevents bindings
# from being drawn multiple times before all events have propigated.
class DrawCycle
  def initialize
    @queue = {}
    @timer = nil
  end

  def queue(binding)
    @queue[binding] = true

    unless @timer
      # Flush once everything else has finished running
      @timer = `setTimeout(function() { self.$flush(); }, 0);`
    end
  end

  def flush
    @timer = nil

    work_queue = @queue
    @queue = {}

    work_queue.each_pair do |binding,_|
      # Call the update if queued
      binding.update
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
volt-0.7.23 lib/volt/page/draw_cycle.rb
volt-0.7.22 lib/volt/page/draw_cycle.rb
volt-0.7.21 lib/volt/page/draw_cycle.rb
volt-0.7.20 lib/volt/page/draw_cycle.rb
volt-0.7.19 lib/volt/page/draw_cycle.rb
volt-0.7.18 lib/volt/page/draw_cycle.rb
volt-0.7.17 lib/volt/page/draw_cycle.rb
volt-0.7.16 lib/volt/page/draw_cycle.rb
volt-0.7.15 lib/volt/page/draw_cycle.rb
volt-0.7.14 lib/volt/page/draw_cycle.rb
volt-0.7.13 lib/volt/page/draw_cycle.rb
volt-0.7.12 lib/volt/page/draw_cycle.rb
volt-0.7.10 lib/volt/page/draw_cycle.rb
volt-0.7.9 lib/volt/page/draw_cycle.rb
volt-0.7.8 lib/volt/page/draw_cycle.rb
volt-0.7.7 lib/volt/page/draw_cycle.rb
volt-0.7.6 lib/volt/page/draw_cycle.rb
volt-0.7.5 lib/volt/page/draw_cycle.rb
volt-0.7.4 lib/volt/page/draw_cycle.rb
volt-0.7.3 lib/volt/page/draw_cycle.rb