Sha256: 83d4cbc4887336f115dbcdc0a04bdab5b2571854bb851ee5a731350dba157e0f

Contents?: true

Size: 461 Bytes

Versions: 4

Compression:

Stored size: 461 Bytes

Contents

module BubbleWrap
  module UIControlWrapper
    def when(events, options={}, &block)
      @callback ||= {}
      @callback[events] ||= []

      unless options[:append]
        @callback[events] = []
        removeTarget(nil, action: nil, forControlEvents: events)
      end

      @callback[events] << block
      block.weak! if BubbleWrap.use_weak_callbacks?
      addTarget(@callback[events].last, action:'call', forControlEvents: events)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bubble-wrap-1.6.0 motion/ui/ui_control_wrapper.rb
bubble-wrap-1.6.0.rc1 motion/ui/ui_control_wrapper.rb
bubble-wrap-1.5.0 motion/ui/ui_control_wrapper.rb
bubble-wrap-1.5.0.rc1 motion/ui/ui_control_wrapper.rb