Sha256: f5a2fa2077b059a176c72bbffded37ef7ccd777d9342ded398f16f3ced330959

Contents?: true

Size: 678 Bytes

Versions: 4

Compression:

Stored size: 678 Bytes

Contents

# frozen_string_literal: true
class Shoes
  module Swt
    class Download
      attr_accessor :busy
      def initialize(_dsl, _app)
        @busy = false
      end

      # This exists to guarantee the callback block for download completion
      # executes on the main UI thread. Without it we get thread access errors.
      def eval_block(blk, result)
        ::Swt.display.asyncExec do
          actually_run_block(blk, result)
        end
      end

      # Why a separate method? So RedrawingAspect can target it!
      def actually_run_block(blk, result)
        blk.call result
        @busy = false
      end

      def busy?
        @busy
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre12 lib/shoes/swt/download.rb
shoes-swt-4.0.0.pre11 lib/shoes/swt/download.rb
shoes-swt-4.0.0.pre10 lib/shoes/swt/download.rb
shoes-swt-4.0.0.pre9 lib/shoes/swt/download.rb