Module: BubbleWrap::UIControlWrapper
- Defined in:
- motion/ui/ui_control_wrapper.rb
Instance Method Summary collapse
Instance Method Details
#when(events, options = {}, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'motion/ui/ui_control_wrapper.rb', line 3 def when(events, = {}, &block) events = BW::Constants.get("UIControlEvent", events) @callback ||= {} @callback[events] ||= [] unless [: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 |