Sha256: be7e0af340833ca2512c49d163db6851863f074f839a93822b94a764818787d3

Contents?: true

Size: 463 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
bubble-wrap-1.7.1 motion/ui/ui_control_wrapper.rb
bubble-wrap-1.7.0 motion/ui/ui_control_wrapper.rb