Sha256: e4ab8ffa3ce3e0b607343892fec0ad0aef56a508cd7db2cbbd6544255f50a54a

Contents?: true

Size: 770 Bytes

Versions: 8

Compression:

Stored size: 770 Bytes

Contents

module Bowline
  module Desktop
    include Bowline::Logging
    extend Bowline::Watcher::Base
    watch :on_tick, :on_idle
    
    ##
    # :singleton-method: on_tick(method = nil, &block)
    # A Watcher event method that gets called every few microseconds,
    # inside the application's main thread.
    # Example:
    #   on_tick { puts "App tick" }
    
    # Return true if we're currently 
    # being executed by bowline-desktop.
    def enabled?
      $0 == "bowline"
    end
    module_function :enabled?
    
    def idle #:nodoc:
      watcher.call(:on_idle)
    rescue => e
      log_error e
    end
    module_function :idle

    def tick #:nodoc:
      watcher.call(:on_tick)
    rescue => e
      log_error e
    end
    module_function :tick
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bowline-0.6.2 lib/bowline/desktop.rb
bowline-0.6.1 lib/bowline/desktop.rb
bowline-0.6.0 lib/bowline/desktop.rb
bowline-0.5.8 lib/bowline/desktop.rb
bowline-0.5.7 lib/bowline/desktop.rb
bowline-0.5.6 lib/bowline/desktop.rb
bowline-0.5.5 lib/bowline/desktop.rb
bowline-0.5.4 lib/bowline/desktop.rb