Sha256: 2ee13adb3d32b746bc61a03e50abbb4aea0ba4f5a9451d6b870d319918ce0ac1

Contents?: true

Size: 774 Bytes

Versions: 5

Compression:

Stored size: 774 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

5 entries across 5 versions & 1 rubygems

Version Path
bowline-0.9.4 lib/bowline/desktop.rb
bowline-0.9.3 lib/bowline/desktop.rb
bowline-0.9.2 lib/bowline/desktop.rb
bowline-0.9.1 lib/bowline/desktop.rb
bowline-0.6.3 lib/bowline/desktop.rb